Skip to main content

ScrapeUnblocker Cloud - Python client & CLI

Deploy, run, schedule and pull data from Scrapy spiders hosted on ScrapeUnblocker Cloud, from Python or the command line.

ScrapeUnblocker Cloud is managed Scrapy hosting: you push an unmodified Scrapy project, buy concurrency slots and run it. The difference from other Scrapy clouds is that traffic goes through ScrapeUnblocker by default, so a spider that gets blocked elsewhere runs here without you writing any proxy or fingerprint code (--unblock).

pip install scrapeunblocker-cloud

No runtime dependencies: this package is pure standard library, so installing it next to your Scrapy project never pulls in a conflicting dependency tree.

Get a token

Create an API token in the ScrapeUnblocker portal under Spider Cloud. Then either run su-cloud login, or set the environment:

export SU_CLOUD_TOKEN="sk_..."
export SU_CLOUD_ORG="acme"
export SU_CLOUD_PROJECT="shop"     # defaults to the current directory name

CLI

su-cloud login                              # store url/token/org/project in ~/.su-cloud.json
su-cloud deploy                             # package the current Scrapy project and build it
su-cloud run products -a category=shoes --unblock --wait
su-cloud jobs --state running
su-cloud logs j1699999999abc --lines 200
su-cloud items j1699999999abc > out.jsonl   # page scraped items to stdout as JSON lines
su-cloud download j1699999999abc -o out.jsonl.gz   # download the whole dataset
su-cloud stats j1699999999abc              # crawl statistics
su-cloud schedules
su-cloud schedule-add nightly "0 2 * * *" products --unblock
su-cloud destinations
su-cloud destination-add mymongo mongodb -s uri=mongodb+srv://... -s database=shop -s collection=products

Library

from scrapeunblocker_cloud import SpiderCloudClient

client = SpiderCloudClient(token="sk_...", org="acme", project="shop")

# deploy the current directory, then run a spider through ScrapeUnblocker
client.deploy(".", notes="add price field")
job = client.run("products", args={"category": "shoes"}, unblock=True)

job.wait()                       # block until it finishes
print(job.state, job.items_total)

for item in job.items():         # stream the scraped data straight back
    print(item)

for line in job.logs(lines=100):
    print(line)

Org and project set on the client are the defaults for every call, so single-project users never repeat themselves. Every method also accepts org= / project= to override per call.

What you can reach

Namespace Methods
client.orgs list, create
client.projects list, create, settings, update_settings
client.deploys list, upload, from_git
client.jobs run, list, get
Job wait, refresh, logs, items, items_page, download, stats, cancel, .state, .done
client.schedules list, create, toggle, delete
client.destinations list, create, delete

Errors

Everything raises a subclass of SpiderCloudError: AuthError (bad token), NotFoundError (unknown org/project/job), APIError (other non-2xx, with .status and .detail), ConnectionFailed (control plane unreachable) and ConfigError (missing token/org/project).

License

MIT

Download files

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

Source Distribution

scrapeunblocker_cloud-0.1.0.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

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

scrapeunblocker_cloud-0.1.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file scrapeunblocker_cloud-0.1.0.tar.gz.

File metadata

  • Download URL: scrapeunblocker_cloud-0.1.0.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for scrapeunblocker_cloud-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f9cba2f2f5cac55d100b736abd85eb9a36bb581b6071c6b84e0447241bb2d9c1
MD5 451339838b5cbbbc7913646ed60a0e9d
BLAKE2b-256 7d14bd7898b87d4b9d73015fbddc11451326a29a7c5e022682b213678e326230

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrapeunblocker_cloud-0.1.0.tar.gz:

Publisher: publish.yml on ScrapeUnblocker/scrapeunblocker-cloud-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scrapeunblocker_cloud-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for scrapeunblocker_cloud-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ae9f0d7caf5e468dbad19d667074d85124da0dd0713c7259697d1247aa5a6de
MD5 6c531286a129a547f2208317a472e938
BLAKE2b-256 a6b24f08946e4622af12a7c4b61015e43901a8c3e1ba74363e18a16bba8934b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrapeunblocker_cloud-0.1.0-py3-none-any.whl:

Publisher: publish.yml on ScrapeUnblocker/scrapeunblocker-cloud-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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