1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-05-31 07:39:44 +03:00

Moved User Agent to constant

This is one of those things that really should be a constant anyway
This commit is contained in:
A_D 2020-07-07 18:37:05 +02:00
parent 5c4c9fd3a7
commit e739923083
No known key found for this signature in database
GPG Key ID: 4BE9EB7DF45076C4

View File

@ -37,6 +37,8 @@ SERVER_AUTH = 'https://auth.frontierstore.net'
URL_AUTH = '/auth'
URL_TOKEN = '/token'
USER_AGENT = 'EDCD-{}-{}'.format(appname, appversion)
SERVER_LIVE = 'https://companion.orerve.net'
SERVER_BETA = 'https://pts-companion.orerve.net'
URL_QUERY = '/profile'
@ -167,7 +169,7 @@ class Auth(object):
def __init__(self, cmdr):
self.cmdr = cmdr
self.session = requests.Session()
self.session.headers['User-Agent'] = 'EDCD-{}-{}'.format(appname, appversion)
self.session.headers['User-Agent'] = USER_AGENT
self.verifier = self.state = None
def refresh(self):
@ -367,7 +369,7 @@ class Session(object):
def start(self, access_token):
self.session = requests.Session()
self.session.headers['Authorization'] = 'Bearer {}'.format(access_token)
self.session.headers['User-Agent'] = 'EDCD-{appname}-{version}'.format(appname=appname, version=appversion)
self.session.headers['User-Agent'] = USER_AGENT
self.state = Session.STATE_OK
def query(self, endpoint):