def _get_station_orders(station_id): client = EsiClient() station = Structure.get_object(station_id, origin_character_id=None) results = client.get_multiple_paginated("/v1/markets/" + str(station.location.region.pk) + "/orders/") # filter out orders not in our target station filtered_orders = [] for order in results: if order["location_id"] == station_id: filtered_orders.append(order) return filtered_orders
def update_subscription_payments(): logger.info('LAUNCH_TASK update_subscription_payments') with general_queue.lock_task('update_subscription_payments'): char = EVEPlayerCharacter.get_object(settings.PAYMENT_CHARACTER_ID) client = EsiClient(authenticating_character=char) journal_entries = client.get_multiple_paginated( "/v4/characters/{}/wallet/journal/".format(char.pk)) for entry in journal_entries: if entry["ref_type"] == "player_donation" and entry.get( "second_party_id") == char.pk: if not SubscriptionPayment.exists(entry["id"]): process_new_payment( EVEPlayerCharacter.get_object(entry["first_party_id"]), entry["amount"], entry["id"], dateutil.parser.parse(entry["date"]), entry.get("reason")) logger.info('FINISH_TASK update_subscription_payments')
def get_character_assets(character_ccp_id): """ :param character_ccp_id: :return: { location_flag : varchar location : ORM Location is_in_container : bool is_blueprint_copy: nullable bool is_singleton: bool item_id: bigint location_type: varchar quantity: bigint type: ORM ObjectType } """ character = EVEPlayerCharacter.get_object(character_ccp_id) # just assume they have the f****n scope #char_keys = EsiKey.objects.filter( # Q(character_id = character_ccp_id) & # Q(use_key=True) #) #for key in char_keys: # if key.has_esi_scope('esi-assets.read_assets.v1'): #if not character.has_esi_scope(): # return None client = EsiClient(authenticating_character=character) assets_pages = client.get_multiple_paginated( "/v3/characters/{}/assets/".format(character_ccp_id)) assets = extract_assets(character, assets_pages) return assets
def _get_citadel_orders(structure_id, auth_char): client = EsiClient(authenticating_character=auth_char) results = client.get_multiple_paginated("/v1/markets/structures/" + str(structure_id) + "/") return results