Proper support for ISO-8601 dates

This commit is contained in:
Maël Kervella 2018-05-24 23:41:23 +00:00
parent de759e417d
commit 74fa513e9a
2 changed files with 7 additions and 4 deletions

View file

@ -1,3 +1,8 @@
## Re2o - API client
This project is providing an abstraction layer to easily use the API of Re2o.
## Requirements
* python3
* python3-iso8601

View file

@ -1,6 +1,7 @@
import requests
from requests.exceptions import HTTPError
import datetime
import iso8601
from . import endpoints
from . import exceptions
@ -32,10 +33,7 @@ class Re2oAPIClient:
response = response.json()
return {
'token': response['token'],
'expiration': datetime.datetime.strptime(
response['expiration'],
'%Y-%m-%dT%H:%M:%S.%fZ'
)
'expiration': iso8601.parse_date(response['expiration'])
}
def get_token(self):