魔改使用工具库
Project description
安装
可以直接输入以下命令:
.. code:: bash
pip install gzspidertools
可选安装1,安装数据库相关的所有依赖:
.. code:: bash
pip install gzspidertools[database]
可选安装2,通过以下命令安装所有依赖:
.. code:: bash
pip install gzspidertools[all]
注:详细的安装介绍请查看 安装指南_。
用法
开发人员只需根据命令生成示例模板,再配置相关设置即可。
用法 ::
查看库版本
gzcmd version
创建项目
gzcmd startproject <project_name>
进入项目根目录
cd <project_name>
替换(覆盖)为真实的配置 .conf 文件:
这里是为了演示方便,正常情况是直接在 VIT 中的 .conf 文件填上你需要的配置即可
cp /root/mytemp/.conf DemoSpider/VIT/.conf
生成爬虫脚本
gzcmd genspider <spider_name> <example.com>
运行脚本
scrapy crawl <spider_name>
注:也可以使用 gzcmd crawl <spider_name>
跑通测试
前提:需要在 tests 的 VIT 目录下创建 .conf 文件,已给出示例文件,请填写测试所需内容,然后:
- 可以直接使用 tox 来运行测试。
- 本库以
poetry_ 开发,那么直接新环境下运行 poetry install 后,手动运行目标测试或 pytest 命令来测
试等皆可。 - 也可以使用 make 工具,make start 然后 make test 即可。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gzspidertools-0.0.22.tar.gz.
File metadata
- Download URL: gzspidertools-0.0.22.tar.gz
- Upload date:
- Size: 79.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.3 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8a4a4c2f94be55e37e04e7f4ba0b860fbe0e0aef858684f7b5cb2e6018e8f1c
|
|
| MD5 |
5489f069b1845e3bb2541a8ebe8b3379
|
|
| BLAKE2b-256 |
f7c5546f0201dff3f41f8687ec9d689e87b78155e9bfce8bebdebff5861b4f36
|
File details
Details for the file gzspidertools-0.0.22-py3-none-any.whl.
File metadata
- Download URL: gzspidertools-0.0.22-py3-none-any.whl
- Upload date:
- Size: 118.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.3 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be55984ac2c90051e3b37a2b74ace439a62c4441055e1d5b099a540785cd1782
|
|
| MD5 |
5f978470c3572944def53017382ac547
|
|
| BLAKE2b-256 |
6f998df0a6c450e0de1212f52f54f51955ad63d1991267a2c79b737e335b4006
|