Skip to main content

ProxyCrawl API Python class

A lightweight, dependency free Python class that acts as wrapper for ProxyCrawl API.

Installing

Choose a way of installing:

  • Download the python class from Github.
  • Or use PyPi Python package manager. pip install proxycrawl

Then import the ProxyCrawlAPI

Python2:

from proxycrawl import ProxyCrawlAPI

Python3:

from proxycrawl.proxycrawl_api import ProxyCrawlAPI

Class usage

First initialize the ProxyCrawlAPI class

api = ProxyCrawlAPI({ 'token': 'YOUR_PROXYCRAWL_TOKEN' })

GET requests

Pass the url that you want to scrape plus any options from the ones available in the API documentation.

api.get(url, options = {})

Example:

response = api.get('https://www.facebook.com/britneyspears')
if response['status_code'] == 200:
    print(response['body'])

You can pass any options from ProxyCrawl API.

Example:

response = api.get('https://www.reddit.com/r/pics/comments/5bx4bx/thanks_obama/', {
    'user_agent': 'Mozilla/5.0 (Windows NT 6.2; rv:20.0) Gecko/20121202 Firefox/30.0',
    'format': 'json'
})
if response['status_code'] == 200:
    print(response['body'])

POST requests

Pass the url that you want to scrape, the data that you want to send which can be either a json or a string, plus any options from the ones available in the API documentation.

api.post(url, dictionary or string data, options = {})

Example:

response = api.post('https://producthunt.com/search', { 'text': 'example search' })
if response['status_code'] == 200:
    print(response['body'])

You can send the data as application/json instead of x-www-form-urlencoded by setting option post_content_type as json.

import json
response = api.post('https://httpbin.org/post', json.dumps({ 'some_json': 'with some value' }), { 'post_content_type': 'json' })
if response['status_code'] == 200:
    print(response['body'])

Javascript requests

If you need to scrape any website built with Javascript like React, Angular, Vue, etc. You just need to pass your javascript token and use the same calls. Note that only .get is available for javascript and not .post.

api = ProxyCrawlAPI({ 'token': 'YOUR_JAVASCRIPT_TOKEN' })
response = api.get('https://www.nfl.com')
if response['status_code'] == 200:
    print(response['body'])

Same way you can pass javascript additional options.

response = api.get('https://www.freelancer.com', { 'page_wait': 5000 })
if response['status_code'] == 200:
    print(response['body'])

Original status

You can always get the original status and proxycrawl status from the response. Read the ProxyCrawl documentation to learn more about those status.

response = api.get('https://craiglist.com')
print(response['headers']['original_status'])
print(response['headers']['pc_status'])

If you have questions or need help using the library, please open an issue or contact us.


Copyright 2019 ProxyCrawl

Release files for proxycrawl 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for proxycrawl 2.0.1
File Size Uploaded
proxycrawl-2.0.1.tar.gz 3.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for proxycrawl 2.0.1
File Interpreter ABI Platform
proxycrawl-2.0.1-py3-none-any.whl Python 3 none any Details
proxycrawl-2.0.1-py2-none-any.whl Python 2 none any Details

Total release size: 19.8 kB

Release files / proxycrawl-2.0.1.tar.gz

Download URL proxycrawl-2.0.1.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
03c97e44f7a24f3c561b53053f3685a5ee58f348cb441105dacb19ba0591f4c6
BLAKE2b-256 checksum
How to use checksums
bdf267918850f8bf968f53be76dfaadd313e1525edfe121cd2ac57958f4487c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.7.3 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/2.7.16

Release files / proxycrawl-2.0.1-py3-none-any.whl

Download URL proxycrawl-2.0.1-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b154117cd9f94449b618f7d590b2357cb8841bcc1a9f14607a70d730acb91720
BLAKE2b-256 checksum
How to use checksums
493ab10a4c43ce4bebc1ec1ab716bec69a9175f4440f215647ac3102149916b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.7.3 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/2.7.16

Release files / proxycrawl-2.0.1-py2-none-any.whl

Download URL proxycrawl-2.0.1-py2-none-any.whl
Size 8.1 kB
Tags Python 2
SHA-256 checksum
How to use checksums
bbf4c819c8c3c40cefa59da2d1a97e79841c4f4856077f53ca6a6877f5577a3b
BLAKE2b-256 checksum
How to use checksums
38132986d14d17a13008f08ab4fd4c18dad714606e07130c174868bd20f6c7c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.7.3 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/2.7.16

Release history Release notifications | RSS feed

3.2.2

1 release file

3.2.1

2 release files

3.2.0

2 release files

3.1.0

3 release files

2.1.0

3 release files

2.0.3

3 release files

This release

2.0.1 This release

3 release files

2.0.0

3 release files

1.1.1

3 release files

1.1.0

3 release files

1.0.1

3 release files

1.0.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page