Skip to main content

scrapyd api

Project description

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日志
    

Project details


Download files

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

Source Distribution

scrapyd_api-0.0.4.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

scrapyd_api-0.0.4-py2.py3-none-any.whl (8.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file scrapyd_api-0.0.4.tar.gz.

File metadata

  • Download URL: scrapyd_api-0.0.4.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for scrapyd_api-0.0.4.tar.gz
Algorithm Hash digest
SHA256 e9532a20d72202da25b95b528f1f854a663fcf7bb3e7ab9f46ae4b7b0e71bf8c
MD5 735f932d07b0b8fe1562362ef30201cd
BLAKE2b-256 7c3082861d449d1f9f24c09bc604d812b37e3d18fc639719eebdeacce3b5670d

See more details on using hashes here.

File details

Details for the file scrapyd_api-0.0.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for scrapyd_api-0.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 20395267fd09523e8ae17a69b8ffb196e5d2c2b9015ce024fb9c1a7233899ad0
MD5 8a7c645caea861483fe91d2928b30449
BLAKE2b-256 ea87c5b4fd10b9d44c854e2328256da43cdcb7057917fb385573f8900c6416c3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page