ScrapingBee Python SDK
Project description
ScrapingBee Python SDK
ScrapingBee is a web scraping API that handles headless browsers and rotates proxies for you. The Python SDK makes it easier to interact with ScrapingBee's API.
Installation
You can install ScrapingBee Python SDK with pip.
pip install scrapingbee
Usage
The ScrapingBee Python SDK is a wrapper around the requests library. ScrapingBee supports GET and POST requests.
Signup to ScrapingBee to get your API key and some free credits to get started.
Making a GET request
>>> from scrapingbee import ScrapingBeeClient
>>> client = ScrapingBeeClient(api_key='REPLACE-WITH-YOUR-API-KEY')
>>> response = client.get('https://www.scrapingbee.com/blog/', params={
# Execute JavaScript code with a Headless Browser
'render_js': True,
# Scroll once
'js_scroll': True,
# Wait 5 seconds before returning the response
'wait': 5000,
# Use a premium proxy
'premium_proxy': True,
# Use a premium proxy in France
'country_code': 'fr',
# Use some data extraction rules
'extract_rules': {'title': 'h1'},
})
>>> response.text
'<!DOCTYPE html><html lang="en"><head>...'
ScrapingBee takes various parameters to render JavaScript, execute a custom JavaScript script, use a premium proxy from a specific geolocation and more. You can find all the supported parameters on ScrapingBee's documentation.
You can send custom cookies and headers like you would normally do with the requests library.
Using ScrapingBee with Scrapy
Scrapy is the most popular Python web scraping framework. You can easily integrate ScrapingBee's API with the Scrapy middleware.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for scrapingbee-1.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9454dbb9130a5df9671a87a67659c9b7a95cac10c5f70d9eb728921749501a1 |
|
MD5 | af4b787453aed8227a5e63392b0a51ce |
|
BLAKE2b-256 | a95b9549d5776b47a3e0c1f4c8a377f9e12f4f416ae8b2647749e47460ed7301 |