From e7be51b70e56a9a8aa361aeaa799e74922ac9a34 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sun, 10 Sep 2023 05:44:17 +0600 Subject: [PATCH] Remove evepraiisal market source --- service/marketSources/__init__.py | 2 +- service/marketSources/evepraisal.py | 83 ----------------------------- service/price.py | 2 +- 3 files changed, 2 insertions(+), 85 deletions(-) delete mode 100644 service/marketSources/evepraisal.py diff --git a/service/marketSources/__init__.py b/service/marketSources/__init__.py index d8962c198..311b3b284 100644 --- a/service/marketSources/__init__.py +++ b/service/marketSources/__init__.py @@ -1 +1 @@ -__all__ = ['evemarketer', 'evepraisal', 'evemarketdata', 'fuzzwork', 'cevemarket'] +__all__ = ['evemarketer', 'evemarketdata', 'fuzzwork', 'cevemarket'] diff --git a/service/marketSources/evepraisal.py b/service/marketSources/evepraisal.py deleted file mode 100644 index 8650a2379..000000000 --- a/service/marketSources/evepraisal.py +++ /dev/null @@ -1,83 +0,0 @@ -# ============================================================================= -# Copyright (C) 2010 Diego Duclos -# -# This file is part of pyfa. -# -# pyfa is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# pyfa is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with pyfa. If not, see . -# ============================================================================= - - -from logbook import Logger - -from eos.saveddata.price import PriceStatus -from service.network import Network -from service.price import Price - -pyfalog = Logger(__name__) - -systemAliases = { - None: 'universe', - 30000142: 'jita', - 30002187: 'amarr', - 30002659: 'dodixie', - 30002510: 'rens', - 30002053: 'hek'} - - -class EvePraisal: - - name = 'evepraisal' - group = 'tranquility' - - def __init__(self, priceMap, system, fetchTimeout): - # Try selected system first - self.fetchPrices(priceMap, max(2 * fetchTimeout / 3, 2), system) - # If price was not available - try globally - if priceMap: - self.fetchPrices(priceMap, max(fetchTimeout / 3, 2)) - - @staticmethod - def fetchPrices(priceMap, fetchTimeout, system=None): - if system not in systemAliases: - return - jsonData = { - 'market_name': systemAliases[system], - 'items': [{'type_id': typeID} for typeID in priceMap]} - baseurl = 'https://evepraisal.com/appraisal/structured.json' - network = Network.getInstance() - resp = network.post(baseurl, network.PRICES, jsonData=jsonData, timeout=fetchTimeout) - data = resp.json() - try: - itemsData = data['appraisal']['items'] - except (KeyError, TypeError): - return - # Cycle through all types we've got from request - for itemData in itemsData: - try: - typeID = int(itemData['typeID']) - price = itemData['prices']['sell']['min'] - orderCount = itemData['prices']['sell']['order_count'] - except (KeyError, TypeError): - continue - # evepraisal returns 0 if price data doesn't even exist for the item - if price == 0: - continue - # evepraisal seems to provide price for some items despite having no orders up - if orderCount < 1: - continue - priceMap[typeID].update(PriceStatus.fetchSuccess, price) - del priceMap[typeID] - - -Price.register(EvePraisal) diff --git a/service/price.py b/service/price.py index f04309ae0..8b82c6225 100644 --- a/service/price.py +++ b/service/price.py @@ -276,4 +276,4 @@ class PriceWorkerThread(threading.Thread): # Import market sources only to initialize price source modules, they register on their own -from service.marketSources import evemarketer, evemarketdata, evepraisal, fuzzwork, cevemarket # noqa: E402 +from service.marketSources import evemarketer, evemarketdata, fuzzwork, cevemarket # noqa: E402