我正在使用pythonrequest.post()
将数据发送到远程数据库。如何使用python使用不同的数据在同一URL上发送多个请求(大约20-30)?
此外,在这种情况下顺序工作是否可以正常工作,还是需要并行发出请求?
import grequests
urls = [
'http://www.heroku.com',
'http://python-tablib.org',
'http://httpbin.org',
'http://python-requests.org',
'http://kennethreitz.com'
]
rs = (grequests.get(u) for u in urls)
grequests.map(rs)
[<Response [200]>, <Response [200]>, <Response [200]>, <Response [200]>, <Response [200]>]
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句