Skip to main content

WebScrapingApi Python SDK

Project description

WebScrapingApi Python SDK

WebScrapingApi is an API that allows scraping websites while using rotating proxies to prevent bans. This SDK for Python makes the usage of the API easier to implement in any project you have.

Installation

Run the following command in the main folder of your project:

pip install webscrapingapi

API Key

To use the API and the SDK you will need a API Key. You can get one by registering at WebScrapingApi

Usage

Using the SDK it's quite easy. You can check out the code from example.py to make things more clear. An example of a GET call to the API is the following:

from webscrapingapi import WebScrapingApiClient

client = WebScrapingApiClient(api_key='YOUR_API_KEY')

response = client.get('https://webscrapingapi.com/', params ={
    # API Parameters
    # Set to 0 (off, default) or 1 (on) depending on whether or not to render JavaScript on the target web page. JavaScript rendering is done by using a browser.
    'render_js': 1,
    # Set datacenter (default) or residential depending on whether proxy type you want to use for your scraping request. Please note that a single residential proxy API request is counted as 25 API requests.
    'proxy_type': 'datacenter',
    # Specify the 2-letter code of the country you would like to use as a proxy geolocation for your scraping API request. Supported countries differ by proxy type, please refer to the Proxy Locations section for details.
    'country': 'us',
    # Set depending on whether or not to use the same proxy address to your request.
    'session': 1,
    # Specify the maximum timeout in milliseconds you would like to use for your scraping API request. In order to force a timeout, you can specify a number such as 1000. This will abort the request after 1000ms and return whatever HTML response was obtained until this point in time.
    'timeout': 10000,
    # Set desktop (default) or mobile or tablet, depending on whether the device type you want to your for your scraping request.
    'device': 'desktop',
    # Specify the option you would like to us as conditional for your scraping API request. Can only be used when the parameter render_js=1 is activated.
    'wait_until': 'domcontentloaded',
    # Some websites may use javascript frameworks that may require a few extra seconds to load their content. This parameters specifies the time in miliseconds to wait for the website. Recommended values are in the interval 5000-10000.
    'wait_for': 0,
}, headers={
    # API Headers
    'authorization': 'bearer test',
    # Specify custom cookies to be passed to the request.
    'cookie': 'test_cookie=abc; cookie_2=def'
})

For a better understanding of the parameters, please check out our documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

webscrapingapi-1.2.6.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

webscrapingapi-1.2.6-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file webscrapingapi-1.2.6.tar.gz.

File metadata

  • Download URL: webscrapingapi-1.2.6.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for webscrapingapi-1.2.6.tar.gz
Algorithm Hash digest
SHA256 2142d1071dff1a3ad4ae0e0d227ec4cbf895a36e4b25b0f6b9289e5d30cc8570
MD5 712f1c90c2a7a377522e046d4beeaf2f
BLAKE2b-256 b41fd7017bb2225934cba531a417d92e674ee1b0a153a68c259e1db978cfe925

See more details on using hashes here.

File details

Details for the file webscrapingapi-1.2.6-py3-none-any.whl.

File metadata

  • Download URL: webscrapingapi-1.2.6-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for webscrapingapi-1.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 95739c0cdb121f47c69e14e60b21e8f379b9fdff28922b4eaa5e501d3464ca7b
MD5 87020a3afbad0b5462797f2f132e18ff
BLAKE2b-256 bf0e796431772e918222390133a17af4c6bc08902f2d1f732e9c1410f0c38878

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page