针对scrapyd 的上传版本 这一API中的参数:project 工程名 version 版本名 egg egg包
1.首先创建一个scrapy项目,通过命令scrapy startproject 项目名
2.一直按同名目录进去,找到spider目录,创建一个.py文件,写入(来自https://docs.scrapy.org/en/latest/intro/overview.html)
import scrapy
class QuotesSpider(scrapy.Spider):
name = "quotes"
start_urls = [
'http://quotes.toscrape.com/tag/humor/',
]
def parse(self, response):
for quote in response.css('div.quote'):
yield {
'text': quote.css('span.text::text').extract_first(),
'author': quote.xpath('span/small/text()').extract_first(),
}
next_page = response.css('li.next a::attr("href")').extract_first()
if next_page is not None:
yield response.follow(next_page, self.parse)
3.保存,创建完成
4.开始生成egg包,进入项目根目录(利用scrapyd客户端进行打包)
scrapyd-deploy -p 项目名 -v 版本名 --build-egg=egg包名.egg