Scrapinghub Command Line Client
raw JSON → 2.17.1 verified Fri May 01 auth: no python
shub is the official command-line client for Scrapinghub, enabling users to deploy, schedule, and manage Scrapy spiders on the Scrapinghub cloud platform. Current version: 2.17.1. Release cadence is irregular.
pip install shub Common errors
error shub: error: argument command: invalid choice: 'deploy' ↓
cause Typo or old command syntax. The correct subcommand is 'deploy' but sometimes used incorrectly with extra arguments.
fix
Use correct syntax: shub deploy [project-id] [--target]
error shub.exceptions.ShubException: Invalid API key ↓
cause API key is missing or incorrect. Not set in environment or passed incorrectly.
fix
Set SHUB_APIKEY environment variable or pass key via shub.login(api_key) with a valid key.
Warnings
gotcha shub requires Python 3.10+. Older Python versions are no longer supported. ↓
fix Upgrade Python to 3.10 or later.
deprecated The old shub deploy command using a YAML config file with a 'project' field is deprecated in favor of using the project ID directly. The 'project' field may be removed in future versions. ↓
fix Use the numeric project ID in your config or command line instead of the project name.
gotcha API key authentication via environment variable SHUB_APIKEY is the recommended method. Using the interactive login command in automated scripts will cause failures. ↓
fix Set SHUB_APIKEY environment variable and call shub.login(api_key) programmatically.
Imports
- shub
import shub
Quickstart
import shub
import os
# Login using API key from environment variable
api_key = os.environ.get('SHUB_APIKEY', '')
if not api_key:
raise Exception("Please set SHUB_APIKEY environment variable")
shub.login(api_key)
# List all projects
projects = shub.projects.list()
print("Projects:", projects)
# Deploy a spider (run from project directory)
# shub.deploy(project_id, target='prod')