fzlee / alipay

Python Alipay(支付宝) SDK with SHA1/SHA256 support
Other
1.29k stars 378 forks source link

希望支持timeout参数 #114

Closed Ehco1996 closed 4 years ago

Ehco1996 commented 4 years ago

Is your feature request related to a problem? Please describe. 请求时发现写死了timeout是15s

Describe the solution you'd like 希望能支持timeout参数,另外发现直接用的是urllib库,想问一下为什么不用requests?

Additional context 附上一个sentry截图

截屏2020-09-06上午8 30 21
fzlee commented 4 years ago

requests库太大,有些地方加载费时。 是什么场景需要自定义超时时间?

On Sun, 6 Sep 2020 at 08:33, Ehco notifications@github.com wrote:

Assigned #114 https://github.com/fzlee/alipay/issues/114 to @fzlee https://github.com/fzlee.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/fzlee/alipay/issues/114#event-3733415859, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOYLNMHFSYDRVX4D74JUVTSELKFFANCNFSM4Q3S4PAA .

-- 顺颂时祺

Fazheng Li

Ehco1996 commented 4 years ago

主要是query_order的时候,服务起在国外的话,call阿里云的接口会经常timeout

fzlee commented 4 years ago

我感觉要是15s还没有返回,加大超时时间大概率也不会有结果。

你暂时试试直接修改我的源代码。超时时间延长,试试有没有效果,如果有的话,我再开放这个选项出来

On Sun, 6 Sep 2020 at 09:28, Ehco notifications@github.com wrote:

主要是query_order的时候,服务起在国外的话,call阿里云的接口会经常timeout

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/fzlee/alipay/issues/114#issuecomment-687684871, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOYLNI7GL3VIBM5HBO7GL3SELQVBANCNFSM4Q3S4PAA .

-- 顺颂时祺

Fazheng Li

Ehco1996 commented 4 years ago

我感觉要是15s还没有返回,加大超时时间大概率也不会有结果。 你暂时试试直接修改我的源代码。超时时间延长,试试有没有效果,如果有的话,我再开放这个选项出来 On Sun, 6 Sep 2020 at 09:28, Ehco @.***> wrote: 主要是query_order的时候,服务起在国外的话,call阿里云的接口会经常timeout — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#114 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOYLNI7GL3VIBM5HBO7GL3SELQVBANCNFSM4Q3S4PAA . -- 顺颂时祺 Fazheng Li

我是想调小timeout,这样可以多retry几次

fzlee commented 4 years ago

有道理,我最近会添加这个参数

On Sun, 6 Sep 2020 at 09:50, Ehco notifications@github.com wrote:

我感觉要是15s还没有返回,加大超时时间大概率也不会有结果。 你暂时试试直接修改我的源代码。超时时间延长,试试有没有效果,如果有的话,我再开放这个选项出来

On Sun, 6 Sep 2020 at 09:28, Ehco @.***> wrote: 主要是query_order的时候,服务起在国外的话,call阿里云的接口会经常timeout — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#114 (comment) https://github.com/fzlee/alipay/issues/114#issuecomment-687684871>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOYLNI7GL3VIBM5HBO7GL3SELQVBANCNFSM4Q3S4PAA . --

顺颂时祺 Fazheng Li

我是想调小timeout,这样可以多retry几次

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/fzlee/alipay/issues/114#issuecomment-687686388, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOYLNMRONSWNPYYBGRBEH3SELTEZANCNFSM4Q3S4PAA .

-- 顺颂时祺

Fazheng Li

fzlee commented 4 years ago

试试2.1.1 吧

from alipay.utils import  AliPayConfig

config = AliPayConfig(timeout=5)
alipay = Alipay(... config=config)
Ehco1996 commented 4 years ago

感谢