diff --git a/CHANGES.txt b/CHANGES.txt index d4e22be4..3ea0b33b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,11 @@ TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014 ============================================================================== +Jul 03 2017 (bgol, horizon branch): +. Updated EDAPI plugin to version 4.2.0 + - Added "login option. + - EDDN Server Migration + May 31 2017 (bgol, horizon branch): . Updated Journal plugin to ignore all events in multicrew. . Missed the station command to output the category name. diff --git a/README.md b/README.md index e0c44ec3..573af9cb 100644 --- a/README.md +++ b/README.md @@ -799,6 +799,7 @@ Frontier provides an API for their mobile app. This can be used to report accura save: Save the API response (tmp/profile.YYYYMMDD_HHMMSS.json). test: Test the plugin with a json file (test=[FILENAME]). warn: Ask for station update if a API<->DB diff is encountered. + login: Ask for login credentials. ##Elite Dangerous netLog parser import plugin: diff --git a/plugins/edapi_plug.py b/plugins/edapi_plug.py index 2c1c55cf..e283420b 100644 --- a/plugins/edapi_plug.py +++ b/plugins/edapi_plug.py @@ -25,7 +25,7 @@ from collections import namedtuple -__version_info__ = ('4', '1', '1') +__version_info__ = ('4', '2', '0') __version__ = '.'.join(__version_info__) # ---------------------------------------------------------------- @@ -116,8 +116,15 @@ def __init__( self.profile = response.json() self.text = response.text except: - sys.exit('Unable to parse JSON response for /profile!\ - Try with --debug and report this.') + if self.debug: + print(' URL:', response.url) + print('status:', response.status_code) + print(' text:', response.text) + sys.exit( + "Unable to parse JSON response for /profile!" + "\nTry to relogin with the 'login' option." + "{}".format("" if self.debug else "\nTry with --debug and report this.") + ) def _getBasicURI(self, uri, values=None): ''' @@ -232,23 +239,23 @@ def _doLogin(self): class EDDN: _gateways = ( - 'http://eddn-gateway.elite-markets.net:8080/upload/', + 'https://eddn.edcd.io:4430/upload/', # 'http://eddn-gateway.ed-td.space:8080/upload/', ) _commodity_schemas = { - 'production': 'http://schemas.elite-markets.net/eddn/commodity/3', - 'test': 'http://schemas.elite-markets.net/eddn/commodity/3/test', + 'production': 'https://eddn.edcd.io/schemas/commodity/3', + 'test': 'https://eddn.edcd.io/schemas/commodity/3/test', } _shipyard_schemas = { - 'production': 'http://schemas.elite-markets.net/eddn/shipyard/2', - 'test': 'http://schemas.elite-markets.net/eddn/shipyard/2/test', + 'production': 'https://eddn.edcd.io/schemas/shipyard/2', + 'test': 'https://eddn.edcd.io/schemas/shipyard/2/test', } _outfitting_schemas = { - 'production': 'http://schemas.elite-markets.net/eddn/outfitting/2', - 'test': 'http://schemas.elite-markets.net/eddn/outfitting/2/test', + 'production': 'https://eddn.edcd.io/schemas/outfitting/2', + 'test': 'https://eddn.edcd.io/schemas/outfitting/2/test', } _debug = True @@ -405,6 +412,7 @@ class ImportPlugin(plugins.ImportPluginBase): 'save': 'Save the API response (tmp/profile.YYYYMMDD_HHMMSS.json).', 'test': 'Test the plugin with a json file (test=[FILENAME]).', 'warn': 'Ask for station update if a API<->DB diff is encountered.', + 'login': 'Ask for login credentials.', } cookieFile = "edapi.cookies" @@ -651,7 +659,11 @@ def run(self): "JSON-file '{}' not found.".format(str(proPath)) ) else: - api = EDAPI(cookiefile=str(self.cookiePath)) + api = EDAPI( + cookiefile=str(self.cookiePath), + login=self.getOption('login'), + debug=tdenv.debug, + ) self.edAPI = api # Sanity check that the commander is docked. Otherwise we will get a @@ -910,7 +922,7 @@ def commodity_int(key): ): eddn_modules = [] for module in api.profile['lastStarport']['modules'].values(): - # see: https://github.com/jamesremuscat/EDDN/wiki + # see: https://github.com/EDSM-NET/EDDN/wiki addModule = False if module['name'].startswith(('Hpt_', 'Int_')) or module['name'].find('_Armour_') > 0: if module.get('sku', None) in (