This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show_progress(has, total): | |
rate = float(has) / float(total) | |
rate_num = int(rate * 100) | |
print('\r%s%% %s' % (rate_num, '#' * int(rate_num / 2)), end='') | |
for i in range(1, 101): | |
show_progress(i, 100) | |
import time | |
time.sleep(0.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Author: Zheng <me@zxyle.cn> | |
# Desc | |
from aiohttp import web, ClientSession | |
async def fetch(session, url): | |
async with session.get(url) as response: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Author: Zheng <me@zxyle.cn> | |
# 采集网站名称: 异步手机号归属地采集 | |
# 主页url: http://m.ip138.com/mobile.asp/ | |
# 使用步骤: | |
# Step0: python 3.5+ | |
# Step1: 安装依赖 pip install aiohttp==3.5.0 parsel==1.5.1 motor==2.0.0 | |
# Step2: 创建唯一索引 db.phone.ensureIndex({"phone":1},{"unique":true}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Author: Zheng <me@zxyle.cn> | |
# Date: 12/15/18 | |
# Desc: 查询股票是否停牌 | |
# install: pip install tornado==5.1.1 | |
import json | |
import tornado.ioloop | |
import tornado.web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Author: Zheng <me@zxyle.cn> | |
# Desc: 云海-自动发货 | |
import time | |
import base64 | |
from hashlib import md5 | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Author: Zheng <zhengxiang@upg.cn> | |
# 采集网站名称: 姚沿-手机号归属地抓爬 | |
# 主页url: http://www.ip138.com/sj/ | |
# 采集策略: | |
from urllib.parse import quote_plus | |
import pymongo | |
import requests |