jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1224950?usp=email )

Change subject: FIX: headers retry_after may be int or float
......................................................................

FIX: headers retry_after may be int or float

Bug: T414197
Change-Id: I13a6cfff60acf85c536a5d19c32e80242b10e792
---
M pywikibot/comms/http.py
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index a4758d1..3686317 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -286,7 +286,9 @@

     baseuri = site.base_url(uri, protocol=kwargs.pop('protocol', None))
     r = fetch(baseuri, headers=headers, **kwargs)
-    site.throttle.retry_after = int(r.headers.get('retry-after', 0))
+    retry_after = r.headers.get('retry-after', '0')
+    # literal of retry_after may int or float (T414197)
+    site.throttle.retry_after = int(float(retry_after))
     return r



--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1224950?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I13a6cfff60acf85c536a5d19c32e80242b10e792
Gerrit-Change-Number: 1224950
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to