Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle missing JSON in error response #98

Merged
merged 1 commit into from
Nov 4, 2023

Conversation

dvx76
Copy link
Member

@dvx76 dvx76 commented Oct 25, 2023

We were getting:

2023-10-25 08:48:46.909 WARNING (MainThread) [skodaconnect.connection] Could not refresh tokens: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://api.connect.skoda-auto.cz/api/v1/authentication/token/refresh?systemId=CONNECT')

API endpoint is currently dead and we're getting 503's, which don't have a JSON payload.

Now:

2023-10-25 18:59:38.978 DEBUG (MainThread) [skodaconnect.connection] No valid access token for "connect"
2023-10-25 18:59:38.978 DEBUG (MainThread) [skodaconnect.connection] Refreshing tokens for client "connect"
2023-10-25 18:59:39.006 WARNING (MainThread) [skodaconnect.connection] Something went wrong when refreshing tokens for "connect".
2023-10-25 18:59:39.010 DEBUG (MainThread) [skodaconnect.connection] Response JSON: <ClientResponse(https://api.connect.skoda-auto.cz/api/v1/authentication/token/refresh?systemId=CONNECT) [503 Service Temporarily Unavailable]>
<CIMultiDictProxy('Date': 'Wed, 25 Oct 2023 18:59:38 GMT', 'Content-Type': 'text/html', 'Content-Length': '190', 'Connection': 'keep-alive', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains', 'Expect-CT': 'max-age=0, enforce', 'Trace-id': 'd634d1ba4d994ace4b18e400202aede8')>

We were getting:

```
2023-10-25 08:48:46.909 WARNING (MainThread) [skodaconnect.connection] Could not refresh tokens: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://api.connect.skoda-auto.cz/api/v1/authentication/token/refresh?systemId=CONNECT')
```

API endpoint is currently dead and we're getting 503's, which don't have
a JSON payload.

Now:

```
2023-10-25 18:59:38.978 DEBUG (MainThread) [skodaconnect.connection] No valid access token for "connect"
2023-10-25 18:59:38.978 DEBUG (MainThread) [skodaconnect.connection] Refreshing tokens for client "connect"
2023-10-25 18:59:39.006 WARNING (MainThread) [skodaconnect.connection] Something went wrong when refreshing tokens for "connect".
2023-10-25 18:59:39.010 DEBUG (MainThread) [skodaconnect.connection] Response: <ClientResponse(https://api.connect.skoda-auto.cz/api/v1/authentication/token/refresh?systemId=CONNECT) [503 Service Temporarily Unavailable]>
<CIMultiDictProxy('Date': 'Wed, 25 Oct 2023 18:59:38 GMT', 'Content-Type': 'text/html', 'Content-Length': '190', 'Connection': 'keep-alive', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains', 'Expect-CT': 'max-age=0, enforce', 'Trace-id': 'd634d1ba4d994ace4b18e400202aede8')>
```
@WebSpider WebSpider merged commit 41ae725 into skodaconnect:main Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants