All Projects → djm → Python Scrapyd Api

djm / Python Scrapyd Api

Licence: bsd-2-clause
A Python wrapper for working with Scrapyd's API.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Python Scrapyd Api

Mega.py
Python library for the https://mega.nz/ API.
Stars: ✭ 145 (-38.3%)
Mutual labels:  api-wrapper
Pybliometrics
Python-based API-Wrapper to access Scopus
Stars: ✭ 181 (-22.98%)
Mutual labels:  api-wrapper
Binance
A .NET Standard Binance API library.
Stars: ✭ 199 (-15.32%)
Mutual labels:  api-wrapper
Pinterest Api Php
A PHP wrapper for the official Pinterest API. 📌
Stars: ✭ 151 (-35.74%)
Mutual labels:  api-wrapper
Nipyapi
A convenient Python wrapper for Apache NiFi
Stars: ✭ 169 (-28.09%)
Mutual labels:  api-wrapper
Riot Api Java
Riot Games API Java Library
Stars: ✭ 184 (-21.7%)
Mutual labels:  api-wrapper
Rcrossref
R client for various CrossRef APIs
Stars: ✭ 137 (-41.7%)
Mutual labels:  api-wrapper
Python Ovh
Thin wrapper around OVH's APIs. Handles all the hard work including credential creation and requests signing.
Stars: ✭ 213 (-9.36%)
Mutual labels:  api-wrapper
Redd
Redd is a batteries-included API wrapper for reddit.
Stars: ✭ 180 (-23.4%)
Mutual labels:  api-wrapper
Discogs
A Ruby wrapper of the Discogs.com API
Stars: ✭ 195 (-17.02%)
Mutual labels:  api-wrapper
Eos Java Rpc Wrapper
Stars: ✭ 162 (-31.06%)
Mutual labels:  api-wrapper
Coingecko Api
A Node.js wrapper for the CoinGecko API with no dependencies.
Stars: ✭ 159 (-32.34%)
Mutual labels:  api-wrapper
Virustotal Api
Virus Total Public/Private/Intel API
Stars: ✭ 189 (-19.57%)
Mutual labels:  api-wrapper
Census Data Downloader
Download U.S. census data and reformat it for humans
Stars: ✭ 149 (-36.6%)
Mutual labels:  api-wrapper
Python Onedrive
Obsolete python/cli module for MS SkyDrive/OneDrive's old API, do not use for new projects
Stars: ✭ 202 (-14.04%)
Mutual labels:  api-wrapper
Twitch Python
Object-oriented Twitch API for Python developers
Stars: ✭ 138 (-41.28%)
Mutual labels:  api-wrapper
Graphql2rest
GraphQL to REST converter: automatically generate a RESTful API from your existing GraphQL API
Stars: ✭ 181 (-22.98%)
Mutual labels:  api-wrapper
Php Ovh
Lightweight PHP wrapper for OVH APIs. That's the easiest way to use OVH.com APIs in your PHP applications.
Stars: ✭ 230 (-2.13%)
Mutual labels:  api-wrapper
Taxize
A taxonomic toolbelt for R
Stars: ✭ 209 (-11.06%)
Mutual labels:  api-wrapper
Github4s
A GitHub API wrapper written in Scala
Stars: ✭ 194 (-17.45%)
Mutual labels:  api-wrapper

python-scrapyd-api

The PyPI version Build status on Travis-CI Coverage status on Coveralls Documentation status on ReadTheDocs

A Python wrapper for working with Scrapyd's API.

Current released version: 2.1.2 (see history).

Allows a Python application to talk to, and therefore control, the Scrapy daemon: Scrapyd.

Install

Easiest installation is via pip:

pip install python-scrapyd-api

Quick Usage

Please refer to the full documentation for more detailed usage but to get you started:

>>> from scrapyd_api import ScrapydAPI
>>> scrapyd = ScrapydAPI('http://localhost:6800')

Add a project egg as a new version:

>>> egg = open('some_egg.egg', 'rb')
>>> scrapyd.add_version('project_name', 'version_name', egg)
# Returns the number of spiders in the project.
3
>>> egg.close()

Cancel a scheduled job:

>>> scrapyd.cancel('project_name', '14a6599ef67111e38a0e080027880ca6')
# Returns the "previous state" of the job before it was cancelled: 'running' or 'pending'.
'running'

Delete a project and all sibling versions:

>>> scrapyd.delete_project('project_name')
# Returns True if the request was met with an OK response.
True

Delete a version of a project:

>>> scrapyd.delete_version('project_name', 'version_name')
# Returns True if the request was met with an OK response.
True

Request status of a job:

>>> scrapyd.job_status('project_name', '14a6599ef67111e38a0e080027880ca6')
# Returns 'running', 'pending', 'finished' or '' for unknown state.
'running'

List all jobs registered:

>>> scrapyd.list_jobs('project_name')
# Returns a dict of running, finished and pending job lists.
{
    'pending': [
        {
            u'id': u'24c35...f12ae',
            u'spider': u'spider_name'
        },
    ],
    'running': [
        {
            u'id': u'14a65...b27ce',
            u'spider': u'spider_name',
            u'start_time': u'2014-06-17 22:45:31.975358'
        },
    ],
    'finished': [
        {
            u'id': u'34c23...b21ba',
            u'spider': u'spider_name',
            u'start_time': u'2014-06-17 22:45:31.975358',
            u'end_time': u'2014-06-23 14:01:18.209680'
        }
    ]
}

List all projects registered:

>>> scrapyd.list_projects()
[u'ecom_project', u'estate_agent_project', u'car_project']

Displays the load status of a service registered:

>>> scrapyd.daemon_status()
{u'finished': 0, u'running': 0, u'pending': 0, u'node_name': u'ScrapyMachine'}

List all spiders available to a given project:

>>> scrapyd.list_spiders('project_name')
[u'raw_spider', u'js_enhanced_spider', u'selenium_spider']

List all versions registered to a given project:

>>> scrapyd.list_versions('project_name'):
[u'345', u'346', u'347', u'348']

Schedule a job to run with a specific spider:

# Schedule a job to run with a specific spider.
>>> scrapyd.schedule('project_name', 'spider_name')
# Returns the Scrapyd job id.
u'14a6599ef67111e38a0e080027880ca6'

Schedule a job to run while passing override settings:

>>> settings = {'DOWNLOAD_DELAY': 2}
>>> scrapyd.schedule('project_name', 'spider_name', settings=settings)
u'25b6588ef67333e38a0e080027880de7'

Schedule a job to run while passing extra attributes to spider initialisation:

>>> scrapyd.schedule('project_name', 'spider_name', extra_attribute='value')
# NB: 'project', 'spider' and 'settings' are reserved kwargs for this
# method and therefore these names should be avoided when trying to pass
# extra attributes to the spider init.
u'25b6588ef67333e38a0e080027880de7'

Setting up the project to contribute code

Please see CONTRIBUTING.md. This will guide you through our pull request guidelines, project setup and testing requirements.

License

2-clause BSD. See the full LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].