Skip to content
Snippets Groups Projects
Commit fbcecdbb authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-272: use request headers to indicate that we only accept aaplication/json format

parent 9ca40d66
No related branches found
No related tags found
1 merge request!213Resolve TMSS-272
......@@ -63,6 +63,7 @@ class TMSSsession(object):
'''open the request session and login'''
self.session.__enter__()
self.session.verify = False
self.session.headers['Accept'] = 'application/json'
if self.authentication_method == self.OPENID:
# get authentication page of OIDC through TMSS redirect
......@@ -162,9 +163,6 @@ class TMSSsession(object):
def get_url_as_json_object(self, full_url: str, params={}) -> object:
'''get resource at the given full url (including http://<base_url>, interpret it as json, and return it as as native object (usually a dict or a list of dicts)'''
if "format=json" not in full_url or params.get("format") != "json":
params['format'] ='json'
response = self.session.get(url=full_url, params=params)
logger.info("%s %s %s on %s", response.request.method.upper(), response.status_code, responses.get(response.status_code), response.request.url)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment