【发布时间】:2016-11-28 05:53:22
【问题描述】:
任务是:
1)send an http get to url based on a parameter
2)Modify the response based on the same parameter
3)send an http post to url based on the same parameter
我目前是通过requests库来做这个的,但是一个一个做这个需要很多时间,最多可以达到20000个。
我尝试了multiprocessing,但由于某种原因,它在发送 5000-10000 次获取和发布后挂起。
我读到了 grequest,但上面写着
Order of these responses does not map to the order of the requests you send out..我需要订单,因为我必须根据我发送的 get 修改每个回复。
这里最好的选择是什么?我也读过关于 threading,tornado 的文章,但是由于我用 multiprocessing 搞砸了我的第一个方法,我想在再次开始之前确定一下
【问题讨论】:
-
您在哪里看到响应的顺序与请求的顺序不匹配?我在 GitHub 页面上没有看到这一点,this 与此相矛盾。编辑:没关系,我看到 imap 不会以相同的顺序返回它们。
-
@PeteyPii 这就是我不确定的...是否也仅适用于
imap或map。因为最后写的是The API for imap is equivalent to the API for map. -
查看源代码似乎向我暗示地图确实与请求保持相同的顺序。