def __init__(self): from pymongo import MongoClient, ASCENDING, DESCENDING from configs import Configs import json configs = Configs() self.client = MongoClient(configs.get('databaseIP'), configs.get('databasePort')) self.db = self.client['DotaSeer'] #self.matches = self.db['Matches'].create_index(('match_id'), unique = True) self.heroes = self.db['Heroes'].create_index('id')
class Api: def __init__(self, api_base_url): from configs import Configs self.configs = Configs() self.api_base_url = self.configs.get(api_base_url) def get(self, resource, payload='') -> dict: uri = self.api_base_url + resource result = requests.get(uri, params=payload) result = result.json() logging.debug(result) return result