mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-03-31 02:36:18 +00:00
Fix date formats
This commit is contained in:
parent
401dff23fb
commit
c30e062210
4 changed files with 13 additions and 7 deletions
|
@ -68,7 +68,7 @@ def create_app(test_config=None):
|
|||
def spec():
|
||||
if app.config["ENABLE_SWAGGER"] == "1":
|
||||
swag = swagger(app)
|
||||
swag["info"]["version"] = "1.2.6"
|
||||
swag["info"]["version"] = "1.2.7"
|
||||
swag["info"]["title"] = "SelfPrivacy API"
|
||||
swag["info"]["description"] = "SelfPrivacy API"
|
||||
swag["securityDefinitions"] = {
|
||||
|
|
|
@ -23,4 +23,4 @@ class ApiVersion(Resource):
|
|||
401:
|
||||
description: Unauthorized
|
||||
"""
|
||||
return {"version": "1.2.6"}
|
||||
return {"version": "1.2.7"}
|
||||
|
|
|
@ -120,7 +120,7 @@ def create_token(name):
|
|||
{
|
||||
"token": token,
|
||||
"name": name,
|
||||
"date": str(datetime.now()),
|
||||
"date": str(datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%fZ")),
|
||||
}
|
||||
)
|
||||
return token
|
||||
|
@ -282,9 +282,15 @@ def _get_new_device_auth_token():
|
|||
new_device = tokens["new_device"]
|
||||
if "expiration" not in new_device:
|
||||
return None
|
||||
if datetime.now() > datetime.strptime(
|
||||
new_device["expiration"], "%Y-%m-%d %H:%M:%S.%f"
|
||||
):
|
||||
if new_device["expiration"].endswith("Z"):
|
||||
expiration = datetime.strptime(
|
||||
new_device["expiration"], "%Y-%m-%dT%H:%M:%S.%fZ"
|
||||
)
|
||||
else:
|
||||
expiration = datetime.strptime(
|
||||
new_device["expiration"], "%Y-%m-%d %H:%M:%S.%f"
|
||||
)
|
||||
if datetime.now() > expiration:
|
||||
return None
|
||||
return new_device["token"]
|
||||
|
||||
|
|
2
setup.py
2
setup.py
|
@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||
|
||||
setup(
|
||||
name="selfprivacy_api",
|
||||
version="1.2.6",
|
||||
version="1.2.7",
|
||||
packages=find_packages(),
|
||||
scripts=[
|
||||
"selfprivacy_api/app.py",
|
||||
|
|
Loading…
Add table
Reference in a new issue