Strip trailing slash from BLENDER_ID_ENDPOINT and removed SystemUtility
The xxxUtility classes are silly, they should be removed or replaced by Python modules.
This commit is contained in:
parent
8d15d0750c
commit
e06a9fdf34
@ -1,4 +1,3 @@
|
|||||||
import os
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
@ -14,16 +13,11 @@ from application import app
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class SystemUtility():
|
|
||||||
def __new__(cls, *args, **kwargs):
|
|
||||||
raise TypeError("Base class may not be instantiated")
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def blender_id_endpoint():
|
def blender_id_endpoint():
|
||||||
"""Gets the endpoint for the authentication API. If the env variable
|
"""Gets the endpoint for the authentication API. If the env variable
|
||||||
is defined, it's possible to override the (default) production address.
|
is defined, it's possible to override the (default) production address.
|
||||||
"""
|
"""
|
||||||
return app.config['BLENDER_ID_ENDPOINT']
|
return app.config['BLENDER_ID_ENDPOINT'].rstrip('/')
|
||||||
|
|
||||||
|
|
||||||
def validate(token):
|
def validate(token):
|
||||||
@ -39,7 +33,7 @@ def validate(token):
|
|||||||
payload = dict(
|
payload = dict(
|
||||||
token=token)
|
token=token)
|
||||||
try:
|
try:
|
||||||
url = "{0}/u/validate_token".format(SystemUtility.blender_id_endpoint())
|
url = "{0}/u/validate_token".format(blender_id_endpoint())
|
||||||
log.debug('POSTing to %r', url)
|
log.debug('POSTing to %r', url)
|
||||||
r = requests.post(url, data=payload)
|
r = requests.post(url, data=payload)
|
||||||
except requests.exceptions.ConnectionError as e:
|
except requests.exceptions.ConnectionError as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user