so I made a request to the server with the pythons request library. The code looks like this (it uses an adapter to match a specific pattern)
def getRequest(self, url, header): """ implementation of a get request """ conn = requests.get(url, headers=header) newBody = conn.content newHeader = conn.headers newHeader['status'] = conn.status_code response = {"Headers" : newHeader, "Body" : newBody.decode('utf-8')} self._huddleErrors.handleResponseError(response) return response
the header parameter I'm processing is
{'Authorization': 'OAuth2 handsOffMyToken', 'Accept': 'application/vnd.huddle.data+json'}
however i get xml response from server. After checking the violinist, I see that the sent request:
Accept-Encoding: identity Accept: */* Host: api.huddle.dev Authorization: OAuth2 HandsOffMyToken Accept: application/vnd.huddle.data+json Accept-Encoding: gzip, deflate, compress User-Agent: python-requests/1.2.3 CPython/3.3.2 Windows/2008ServerR2
As we can see, there are 2 Accept Headers! The query library adds Accept: * / * to this header, which the server drops. Does anyone know how I can stop this?
source share