Skip to content

Best Rotating Proxy & Scraping API Alternative. Python Example.

Notifications You must be signed in to change notification settings

scrape-do/python-sample

Repository files navigation

Scrape.do python-sample

scrape.do

Web Scraper API

You can send request to any webpages with proxy gateway & web api provided by scrape.do. As you can see from the example, this takes only few lines of code

You can see Example here (test.py)

Usage

first you need to create python_sample as python-sample

and use python_sample class to handle scrape.do api's

from python_sample_scrape_do import Scrape_do_Exception, python_sample

API_TOKEN = "Your_API_TOKEN_FOR_scrape.do"

# create an python-sample object
sample = python_sample()

# set the scrape.do api key
sample.set_api_token(api_token=API_TOKEN)

# Get Scrape.do account statistics
try:
    resp = sample.account_status()
    print("Response Type " + str(type(resp)))
    print(resp)
except ConnectionError as e:
    print(str(e))
    print(traceback.format_exc())

except Scrape_do_Exception as e:
    print(str(e))
    print(traceback.format_exc())

try:
    resp = sample.create_request_url(url='https://docs.scrape.do/', method="GET", payload={}, headers={},
                                     render=False, super_proxies=False, geo_code=None)
    print(resp)
except ConnectionError as e:
    print(str(e))
    print(traceback.format_exc())

except Scrape_do_Exception as e:
    print(str(e))
    print(traceback.format_exc())

Screenshot


python-sample