From 1b9a98e5595b616b77c0515b3ca7fa3a07718c81 Mon Sep 17 00:00:00 2001 From: Luke Faraone Date: Thu, 28 Mar 2013 12:47:26 -0700 Subject: [PATCH] Alternatively send request data using "params" if request method is GET Previously we sent it always as "data", which caused problems for GET requests where there is no request body. (imported from commit 20084d1da1b8228cc484536ca4d6f77f547a9d78) --- humbug/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/humbug/__init__.py b/humbug/__init__.py index bc0100f..10ffaf9 100644 --- a/humbug/__init__.py +++ b/humbug/__init__.py @@ -137,13 +137,18 @@ class Client(object): while True: try: + if method == "GET": + kwarg = "params" + else: + kwarg = "data" + kwargs = {kwarg: query_state["request"]} res = requests.request( method, urlparse.urljoin(self.base_url, url), auth=requests.auth.HTTPBasicAuth(self.email, self.api_key), - data=query_state["request"], - verify=True, timeout=55) + verify=True, timeout=55, + **kwargs) # On 50x errors, try again after a short sleep if str(res.status_code).startswith('5'):