Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ESI endpoint #22

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ script:
- "python scripts/manage_api.py --testkey"
- "python scripts/create_splitcache.py --regions=10000002 --type=34,35 --range=30 --db=publicAPI/cache/travis_splitcache.json --source=esi"
- "python setup.py test"
branches:
only:
- master
- v1.2_withsplit
after_success:
- "pip install python-coveralls"
- "coveralls"
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
prosper-api (1.4.0) stable; urgency=high

* Fixes ESI ROOT endpoint
* Deprecates EMD routes due to bug #21
* Deprecates plex-split functionality (>600 days since patch)
-- John Purcell <[email protected]> Sun, 20 Jan 2019 18:30:00 -0700

prosper-api (1.3.0) stable; urgency=low

* Fixes serious test errors
Expand Down
76 changes: 38 additions & 38 deletions publicAPI/crest_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import publicAPI.api_utils as api_utils
import publicAPI.exceptions as exceptions
import publicAPI.config as api_config
import publicAPI.split_utils as split_utils
# import publicAPI.split_utils as split_utils

import prosper.common.prosper_logging as p_logging
import prosper.common.prosper_config as p_config
Expand Down Expand Up @@ -127,21 +127,21 @@ def get(self, return_type):
## Fetch CREST ##
try:
#LOGGER.info(api_config.SPLIT_INFO)
if args.get('typeID') in api_config.SPLIT_INFO:
self.logger.info('FORK: using split utility')
data = split_utils.fetch_split_history(
args.get('regionID'),
args.get('typeID'),
config=api_config.CONFIG,
logger=self.logger,
)
else:
data = crest_utils.fetch_market_history(
args.get('regionID'),
args.get('typeID'),
config=api_config.CONFIG,
logger=LOGGER
)
# if args.get('typeID') in api_config.SPLIT_INFO:
# self.logger.info('FORK: using split utility')
# data = split_utils.fetch_split_history(
# args.get('regionID'),
# args.get('typeID'),
# config=api_config.CONFIG,
# logger=self.logger,
# )
# else:
data = crest_utils.fetch_market_history(
args.get('regionID'),
args.get('typeID'),
config=api_config.CONFIG,
logger=LOGGER
)
data = crest_utils.data_to_ohlc(data)
except exceptions.ValidatorException as err: #pragma: no cover
self.logger.error(
Expand Down Expand Up @@ -304,28 +304,28 @@ def get(self, return_type):

## No cache, get data ##
try:
if args.get('typeID') in api_config.SPLIT_INFO:
LOGGER.info('FORK: using split utility')
data = split_utils.fetch_split_history(
args.get('regionID'),
args.get('typeID'),
data_range=api_config.MAX_RANGE,
config=api_config.CONFIG,
logger=self.logger,
)
data.sort_values(
by='date',
ascending=True,
inplace=True
)
else:
data = forecast_utils.fetch_extended_history(
args.get('regionID'),
args.get('typeID'),
data_range=api_config.MAX_RANGE,
config=api_config.CONFIG,
logger=self.logger,
)
# if args.get('typeID') in api_config.SPLIT_INFO:
# LOGGER.info('FORK: using split utility')
# data = split_utils.fetch_split_history(
# args.get('regionID'),
# args.get('typeID'),
# data_range=api_config.MAX_RANGE,
# config=api_config.CONFIG,
# logger=self.logger,
# )
# data.sort_values(
# by='date',
# ascending=True,
# inplace=True
# )
# else:
data = forecast_utils.fetch_extended_history(
args.get('regionID'),
args.get('typeID'),
data_range=api_config.MAX_RANGE,
config=api_config.CONFIG,
logger=self.logger,
)
data = forecast_utils.build_forecast(
data,
api_config.MAX_RANGE
Expand Down
3 changes: 2 additions & 1 deletion publicAPI/crest_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ def fetch_crest_endpoint_get():

return data

ESI_BASE = 'https://esi.tech.ccp.is/latest/'
# ESI_BASE = 'https://esi.tech.ccp.is/latest/'
ESI_BASE = 'https://esi.evetech.net/latest/'
def fetch_esi_endpoint(
endpoint_name,
esi_base=ESI_BASE,
Expand Down
2 changes: 1 addition & 1 deletion publicAPI/forecast_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def fetch_market_history_emd(
'region_ids': region_id,
'type_ids': type_id,
'days': data_range,
'char_name': config.get('GLOBAL', 'useragent_short')
'char_name': 'lockefox',
}
headers = {
'User-Agent': config.get('GLOBAL', 'useragent')
Expand Down
4 changes: 3 additions & 1 deletion publicAPI/split_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import publicAPI.exceptions as exceptions

HERE = path.abspath(path.dirname(__file__))

DeprecationWarning('PLEX split happened too far back for dependencies to work')
class SplitInfo(object):
"""utility for managing split information"""
def __init__(self, json_entry=None):
Expand Down Expand Up @@ -293,7 +295,7 @@ def execute_split(
def fetch_split_history(
region_id,
type_id,
fetch_source=api_config.SwitchCCPSource.EMD,
fetch_source=api_config.SwitchCCPSource.ESI,
data_range=400,
config=api_config.CONFIG,
logger=logging.getLogger('publicAPI')
Expand Down
1 change: 1 addition & 0 deletions tests/test_forecast_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

CONFIG = helpers.get_config(CONFIG_FILENAME)

@pytest.mark.skip('EMD No longer reliable')
def test_fetch_emd_history(config=CONFIG):
"""happypath test for `fetch_market_history_emd`"""
data = forecast_utils.fetch_market_history_emd(
Expand Down
Loading