We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
图片能下载下来,运行也没报错,可是有些图片是能打开的,有些图片时损坏的,而且损坏的占了7层多,用的是最新版 0.0.10
import datetime import trip today_date = datetime.datetime.now().strftime('%Y-%m-%d') headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36', 'Accept': 'image/webp,image/apng,image/*,*/*;q=0.8', 'Referer': 'http://iir.circ.gov.cn/ipq/', 'Connection': 'close', 'content-type': 'application/json' } @trip.coroutine def download(i): try: s = trip.Session() res = yield s.get( 'http://iir.circ.gov.cn/ipq/captchacn.svl?Mon%20May%2013%202019%2017:14:14%20GMT+0800%20(%E4%B8%AD%E5%9B%BD%E6%A0%87%E5%87%86%E6%97%B6%E9%97%B4)', stream=True, headers=headers, timeout=25) file_name = 'E://captcha2//{0}_{1}.jpg'.format(today_date, i) if 200 == res.status_code: print (file_name) with open(file_name, 'wb') as fd: for chunk in res.iter_content(1024): chunk = yield chunk fd.write(chunk) except: import traceback print(traceback.format_exc()) def run(): yield [download(i) for i in range(1, 50)] trip.run(run)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
图片能下载下来,运行也没报错,可是有些图片是能打开的,有些图片时损坏的,而且损坏的占了7层多,用的是最新版 0.0.10
The text was updated successfully, but these errors were encountered: