Skip to main content

PAB - APCloudy Deployment Tool

PyPI version Documentation Status Python Support License: MIT GitHub stars GitHub issues

PAB is a command-line tool for deploying Scrapy spiders to APCloudy, similar to how shub works with Scrapinghub. It provides an easy way to manage and deploy your web scraping projects to the APCloudy platform.

📖 Documentation

For comprehensive documentation, visit: https://pab-cli.readthedocs.io/

Features

  • 🚀 Easy deployment of Scrapy spiders to APCloudy
  • 🔐 Secure authentication and credential management
  • 📦 Automatic project packaging and upload
  • 📋 Project and spider management
  • 🔄 Real-time deployment status tracking
  • 🌟 Cross-platform support (Windows, macOS, Linux)

Installation

You can install PAB using pip:

pip install pab-cli

Or install from source:

git clone https://github.com/fawadss1/pab-cli.git
cd pab-cli
pip install -e .

Quick Start

1. Login to APCloudy

pab login

This will prompt you for your APCloudy API key and save it securely.

2. List Available Projects

pab projects

This will show you all available projects with their IDs.

3. Deploy a Spider

Navigate to your Scrapy project directory and run:

pab deploy <project-id>

For example:

pab deploy 5465

PAB will automatically package your project and deploy it to the specified project on APCloudy.

You can also specify additional options:

pab deploy 5465 --version v0.2.4 --target /path/to/project

Commands

Authentication

  • pab login - Login to APCloudy with API key
  • pab logout - Logout from APCloudy
  • pab status - Show current authentication status

Deployment

  • pab deploy <project-id> - Deploy current project to specified APCloudy project
  • pab deploy <project-id> --version <version> - Deploy with specific version tag
  • pab deploy <project-id> --target <path> - Deploy from specific directory

Project Management

  • pab projects - List all available projects
  • pab spiders <project-id> - List spiders in a project

Configuration

PAB stores configuration in:

  • Windows: %APPDATA%\pab\pab_config.json
  • macOS/Linux: ~/.pab/pab_config.json

Examples

Basic Usage

# Login to APCloudy
pab login

# List available projects to get project IDs
pab projects

# Deploy to project ID 5465
pab deploy 5465

# Check authentication status
pab status

# List spiders in a project
pab spiders 5465

Advanced Usage

# Deploy with specific version
pab deploy 5465 --version production-2024

# Deploy from different directory
pab deploy 5465 --target /path/to/project

# Deploy with custom version and target
pab deploy 5465 --version v1.2.3 --target /my/scrapy/project

API Endpoints

PAB communicates with APCloudy using the following API endpoints:

  • POST /api/cli/auth/authenticate - API key authentication
  • POST /api/cli/auth/refresh - Token refresh
  • GET /api/cli/projects - List projects
  • POST /api/cli/projects/{id}/deploy - Deploy spider
  • GET /api/cli/projects/{id}/spiders - List spiders
  • GET /api/cli/deployments/{id}/status - Deployment status

Requirements

  • Python 3.7+
  • Scrapy 2.0+
  • Valid APCloudy account and API key

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support, please contact:

Changelog

v0.2.5 (2025-11-20)

  • Session handling: Clear stored credentials when tokens expire or refresh fails
  • Login UX: pab login no longer reports "already logged in" with stale credentials
  • HTTP client: Centralized 401 handling with automatic credential invalidation

v0.2.0 (2025-11-10)

  • Pre-deployment Validation: Added comprehensive spider validation before deployment
    • Syntax error detection using Python's compile() function
    • Undefined variable detection with AST-based static analysis
    • Import error validation to catch missing modules and import failures
    • Spider structure validation for Scrapy-specific requirements
  • Smart Validation: Script files in scripts/ directory are skipped during import validation to avoid false positives from API calls
  • Package Validation: Added package size validation to prevent uploading empty (0-byte) packages
  • Enhanced Error Reporting: Improved error messages with file paths and line numbers for easier debugging
  • Code Optimization: Removed unused imports and variables for cleaner codebase
  • Builtin Support: Fixed validator to correctly recognize Python builtins (len, str, int, Exception, etc.)
  • Token Refresh Handling: Improved HTTP client to read file content into memory for reliable token refresh retries
  • Debug Logging: Added detailed logging during package creation for better troubleshooting

v0.1.0 (2025-08-06)

  • Initial release
  • Basic authentication and deployment functionality
  • Project and spider management
  • Cross-platform support

Made with ❤️ by Fawad Ali for AskPablos

Metadata

Release files for pab-cli 0.2.5

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

Source distribution (sdist)

Source distribution for pab-cli 0.2.5
File Size Uploaded Provenance Actions
pab_cli-0.2.5.tar.gz 34.5 kB Without provenance Details for pab_cli-0.2.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pab-cli 0.2.5
File Interpreter ABI Platform Actions
pab_cli-0.2.5-py3-none-any.whl Python 3 none any Details for pab_cli-0.2.5-py3-none-any.whl

Total release size: 53.2 kB

Release files / pab_cli-0.2.5.tar.gz

Download URL pab_cli-0.2.5.tar.gz
Size 34.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b360e517abbbf312a0c46c929ea32704acaa0e39af9f2742b77156e1ccd99d93
BLAKE2b-256 checksum
How to use checksums
5c40aa3b5dd06db6d0f4da19ef736c77bbbd326f1790961671238f9f8b315fd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / pab_cli-0.2.5-py3-none-any.whl

Download URL pab_cli-0.2.5-py3-none-any.whl
Size 18.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0da597ee895617d31d384caca917e71cdda9391b0f8b611b33345da5bdf00ce
BLAKE2b-256 checksum
How to use checksums
f814d2c27cc55c86b64c095f3c5fa2d310c8276ff2b6bcc2f66d9c8c8113f8b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for pab-cli 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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