This commit is contained in:
emmatveev 2024-11-24 23:54:28 +03:00
parent 4e5d483208
commit bc4f74e20f

View File

@ -1,5 +1,4 @@
import json
import os
import typing
import urllib.parse
from threading import Thread
@ -15,11 +14,8 @@ class PlatformClient:
self.stage = stage
self.configs = configs
self.experiments = experiments
self.endpoint = 'https://platform.sprinthub.ru/'
self.configs_url = urllib.parse.urljoin(self.endpoint, 'configs/get')
self.experiments_url = urllib.parse.urljoin(self.endpoint, 'experiments/get')
self.staff_url = urllib.parse.urljoin(self.endpoint, 'is_staff')
self.fetch_url = urllib.parse.urljoin(self.endpoint, 'fetch')
self.endpoint = 'http://configurator/'
self.fetch_url = urllib.parse.urljoin(self.endpoint, '/api/v1/fetch')
self.config_storage = {}
self.experiment_storage = {}
self.staff_storage = {}
@ -44,7 +40,6 @@ class PlatformClient:
try:
response = get(
url,
headers={'X-Security-Token': self.platform_security_token},
params=params
)
if response.status_code == 200:
@ -117,13 +112,3 @@ class PlatformClient:
def get_experiment(self, name):
return self.experiment_storage[name]
platform = PlatformClient(
os.getenv('PLATFORM_SECURITY_TOKEN'),
'РУЗ Бот',
os.getenv('STAGE'),
['words'],
['alice'],
need_poll=True,
)