tianqi.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:weather 作者: awolfly9 项目源码 文件源码
def start_requests(self):
        for cityid, cityname in cityids.items():
            url = 'http://wthrcdn.etouch.cn/weather_mini?citykey=%s' % cityid

            yield Request(
                    url = url,
                    method = 'GET',
                    headers = {
                        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
                        'Accept-Encoding': 'gzip, deflate',
                        'Accept-Language': 'en-US,en;q=0.5',
                        'Connection': 'keep-alive',
                        'Host': 'wthrcdn.etouch.cn',
                        'Upgrade-Insecure-Requests': '1',
                        'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:50.0) Gecko/20100101 '
                                      'Firefox/50.0',
                    },
                    meta = {
                        'cityid': cityid,
                        'cityname': cityname,
                    },
                    callback = self.get_sk_2d_weather,
            )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号