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)
This commit is contained in:
		
							parent
							
								
									e4f3bf881c
								
							
						
					
					
						commit
						1b9a98e559
					
				
					 1 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -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'):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue