<commit_before># a 'dumb' temporary synchronous HTTP placeholder, to be ultimately replaced with async functionality

import config
import modifiers

import requests

# consider using an inheritance model for orders/citadel/history esp. since their data will be used differently anyhow


class EsiMarketClient:

    ESI_URL = 'https://esi.tech.ccp.is/latest/'

    ESI_ENDPTS = {
        'orders':   'markets/{}/orders/',
        'history':  'markets/{}/history/',
        'citadels': 'markets/structures/{}/'
    }

    def __init__(self, hub_name):
        hub_data = config.get_hub(hub_name)

        self.hub        = hub_name
        self.region_id  = hub_data['region_id']
        # self.system_id  = hub_data['system_id']
        # self.station_id = hub_data['station_id']

        self.orders   = []
        # self.history  = []    # class not currently structured with market history in mind
        # self.citadels = []    # class not currently structured with market history in mind

    def _url_format(self, req_type, num_id):
        return self.ESI_URL + self.ESI_ENDPTS[req_type].format(num_id)

    # fully abstracted retrieval once differences between orders, history, citadels are properly understood
    def _retrieve(self, url_list):

        # retries  = []
        # failures = {}

        data     = []

        with requests.Session() as s:
            for url in url_list:
                print('\nTrying: {}'.format(url))
                resp = s.get(url)
                print('Status {} ---- {} results.'.format(resp.status_code, len(resp.json())))
                if resp.status_code == 200 and resp.json():    # placeholder validation
                    data += resp.json()
        return data

    @modifiers.timed
    def get_orders(self, pages):
        print('\nGetting market orders for {}:'.format(self.hub))
        url        = self._url_format('orders', str(self.region_id)) + '?page={}'
        order_urls = [url.format(x) for x in range(1, pages+1)]

        self.orders = self._retrieve(order_urls)
        print('\nGot {} market orders.'.format(len(self.orders)))

    def get_history(self):
        # not currently accounted for
        pass

    def get_citadels(self):
        # not currently accounted for
        pass

# rens = EsiMarketClient('rens')
# rens.get_orders(pages=10)<commit_msg>fix: NoneType arising from capitalisation<commit_after># a 'dumb' temporary synchronous HTTP placeholder, to be ultimately replaced with async functionality

import config
import modifiers

import requests

# consider using an inheritance model for orders/citadel/history esp. since their data will be used differently anyhow


class EsiMarketClient:

    ESI_URL = 'https://esi.tech.ccp.is/latest/'

    ESI_ENDPTS = {
        'orders':   'markets/{}/orders/',
        'history':  'markets/{}/history/',
        'citadels': 'markets/structures/{}/'
    }

    def __init__(self, hub_name):
        hub_data = config.get_hub(hub_name)

        self.hub        = hub_name.lower()
        self.region_id  = hub_data['region_id']
        # self.system_id  = hub_data['system_id']
        # self.station_id = hub_data['station_id']

        self.orders   = []
        # self.history  = []    # class not currently structured with market history in mind
        # self.citadels = []    # class not currently structured with market history in mind

    def _url_format(self, req_type, num_id):
        return self.ESI_URL + self.ESI_ENDPTS[req_type].format(num_id)

    # fully abstracted retrieval once differences between orders, history, citadels are properly understood
    def _retrieve(self, url_list):

        # retries  = []
        # failures = {}

        data     = []

        with requests.Session() as s:
            for url in url_list:
                print('\nTrying: {}'.format(url))
                resp = s.get(url)
                print('Status {} ---- {} results.'.format(resp.status_code, len(resp.json())))
                if resp.status_code == 200 and resp.json():    # placeholder validation
                    data += resp.json()
        return data

    @modifiers.timed
    def get_orders(self, pages):
        print('\nGetting market orders for {}:'.format(self.hub))
        url        = self._url_format('orders', str(self.region_id)) + '?page={}'
        order_urls = [url.format(x) for x in range(1, pages+1)]

        self.orders = self._retrieve(order_urls)
        print('\nGot {} market orders.'.format(len(self.orders)))

    def get_history(self):
        # not currently accounted for
        pass

    def get_citadels(self):
        # not currently accounted for
        pass
{'fraction_non_alphanumeric': 0.11619415807560138, 'fraction_numerical': 0.002577319587628866, 'mean_word_length': 2.4042397660818713, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2193467', 'n_tokens_mistral': 1407, 'n_tokens_neox': 1343, 'n_words': 348}