Proper support for ISO-8601 dates
This commit is contained in:
parent
de759e417d
commit
74fa513e9a
2 changed files with 7 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
## Re2o - API client
|
## Re2o - API client
|
||||||
|
|
||||||
This project is providing an abstraction layer to easily use the API of Re2o.
|
This project is providing an abstraction layer to easily use the API of Re2o.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
* python3
|
||||||
|
* python3-iso8601
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import requests
|
import requests
|
||||||
from requests.exceptions import HTTPError
|
from requests.exceptions import HTTPError
|
||||||
import datetime
|
import datetime
|
||||||
|
import iso8601
|
||||||
|
|
||||||
from . import endpoints
|
from . import endpoints
|
||||||
from . import exceptions
|
from . import exceptions
|
||||||
|
@ -32,10 +33,7 @@ class Re2oAPIClient:
|
||||||
response = response.json()
|
response = response.json()
|
||||||
return {
|
return {
|
||||||
'token': response['token'],
|
'token': response['token'],
|
||||||
'expiration': datetime.datetime.strptime(
|
'expiration': iso8601.parse_date(response['expiration'])
|
||||||
response['expiration'],
|
|
||||||
'%Y-%m-%dT%H:%M:%S.%fZ'
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_token(self):
|
def get_token(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue