To make it easier to get up and running, you can also use our Python SDK. First, you will need to install the SDK:
pipinstallscraperapi-sdk
Then integrate it into your code:
from scraperapi_sdk import ScraperAPIClientclient =ScraperAPIClient('APIKEY')result = client.get(url ='https://httpbin.org/ip')print(result)# Scrapy users can simply replace the urls in their start_urls and parse function# Note for Scrapy, you should not use DOWNLOAD_DELAY and# RANDOMIZE_DOWNLOAD_DELAY, these will lower your concurrency and are not# needed with our API# ...other scrapy setup codestart_urls =[client.scrapyGet(url ='https://httpbin.org/ip')]defparse(self,response):# ...your parsing logic hereyield scrapy.Request(client.scrapyGet(url ='https://httpbin.org/ip'), self.parse)
To enable extra functionality while using our SDK, add an additional parameter to the GET request: