Skip to content

Getting a server's response when the request status code is not 2XX #6558

Answered by adamko147
zahranicak asked this question in Q&A
Discussion options

You must be logged in to vote

I remember fixing this with #5407
does it work fine when you change your code as follows?

           async with session.post(route, data=data, headers=self._headers) as resp:
                resp_json = await resp.json()
                if resp.ok:
                    self._headers['Authorization'] = 'Bearer ' + json['resp_json']
                else:
                    raise InvalidGrant(response)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@zahranicak
Comment options

@adamko147
Comment options

Answer selected by zahranicak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants