Skip to main content

scrapyd API

Github: https://github.com/mouday/scrapyd-api

Gitee: https://gitee.com/mouday/scrapyd-api

Pypi: https://pypi.org/project/scrapyd-api

安装

pip install scrapyd-api

使用示例

# -*- coding: utf-8 -*-
from pprint import pprint

from scrapyd_api import ScrapydClient

client = ScrapydClient()
pprint(client.daemon_status())
"""
{'finished': 67,
 'node_name': 'localhost',
 'pending': 0,
 'running': 0,
 'status': 'ok',
 'total': 67}
"""

简介

说明,基于scrapyd 1.2.1进行调用,如果版本差异大,可能会出现异常

ScrapydAPI对原有的Scrapyd api进行原样返回,有利于二次开发

接口文档:https://scrapyd.readthedocs.io/en/stable/api.html

class ScrapydAPI:
    add_version
    cancel
    delete_project
    delete_version
    list_jobs
    list_projects
    list_spiders
    list_versions
    schedule
    daemon_status

ScrapydClient类继承自 ScrapydAPI,对其进行了扩展和加强

class ScrapydClient(ScrapydAPI):
    # 加强的数据接口
    daemon_status             # 增加了返回参数 total
    add_version               # 添加version 默认值为当前时间戳 10位
    list_spiders              # 返回值:列表+字符串 改为 列表+字典
    list_projects             # 返回值:列表+字符串 改为 列表+字典
    list_versions             # 返回值:列表+字符串 改为 列表+字典  

    # 扩展的数据接口
    job_status                # 查询任务状态
    list_versions_format      # 格式化版本号为日期时间格式 '%Y-%m-%d %H:%M:%S'
    list_jobs_merge           # 合并后的任务列表
    cancel_all_project_job    # 取消所有项目下的任务
    cancel_all_job            # 取消指定项目下的任务

    # 扩展的日志接口
    logs                      # 获取日志-项目列表
    project_logs              # 获取日志-爬虫列表
    spider_logs               # 获取日志-任务列表
    job_log                   # 获取job日志
    

Metadata

Release files for scrapyd-api 0.0.4

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

Source distribution (sdist)

Source distribution for scrapyd-api 0.0.4
File Size Uploaded
scrapyd_api-0.0.4.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scrapyd-api 0.0.4
File Interpreter ABI Platform
scrapyd_api-0.0.4-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 15.9 kB

Release files / scrapyd_api-0.0.4.tar.gz

Download URL scrapyd_api-0.0.4.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e9532a20d72202da25b95b528f1f854a663fcf7bb3e7ab9f46ae4b7b0e71bf8c
BLAKE2b-256 checksum
How to use checksums
7c3082861d449d1f9f24c09bc604d812b37e3d18fc639719eebdeacce3b5670d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / scrapyd_api-0.0.4-py2.py3-none-any.whl

Download URL scrapyd_api-0.0.4-py2.py3-none-any.whl
Size 8.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
20395267fd09523e8ae17a69b8ffb196e5d2c2b9015ce024fb9c1a7233899ad0
BLAKE2b-256 checksum
How to use checksums
ea87c5b4fd10b9d44c854e2328256da43cdcb7057917fb385573f8900c6416c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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