- * 用于展开/收集元组, ** 用于展开/收集字典
- request类库:http://docs.python-requests.org/zh_CN/latest/
- 计算图片MD5,如果MD5一致,判断为同一张图片
def calMD5(url):
r = requests.get(url)
imgBytes = r.content
hl = hashlib.md5()
hl.update(imgBytes)
re = hl.hexdigest()
return re
- 异步HTTP库aiohttp: https://hubertroy.gitbooks.io/aiohttp-chinese-documentation/content/
sslcontext = ssl.create_default_context(cafile='/test.crt')
async with aiohttp.ClientSession() as session:
async with session.post('/',data='',ssl_context=sslcontext) as r:
- 协程:https://docs.python.org/3/library/asyncio-task.html
sema = asyncio.Semaphore(2)
with (await sema):
sslcontext........
async ..........