Skip to content

Commit

Permalink
Refactored; using the pyroyale package for API usage rather than inte…
Browse files Browse the repository at this point in the history
…rnal implementation.
  • Loading branch information
AaronTraas committed Apr 18, 2019
1 parent 966786b commit 643ed6c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 213 deletions.
2 changes: 1 addition & 1 deletion crtools/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.15.16"
__version__ = "2.0.0"
104 changes: 0 additions & 104 deletions crtools/api.py

This file was deleted.

12 changes: 6 additions & 6 deletions crtools/crtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import logging
import math
import os
import pyroyale
import shutil
import tempfile

from ._version import __version__
from crtools import api
from crtools import history
from crtools import leagueinfo

Expand Down Expand Up @@ -504,7 +504,7 @@ def build_dashboard(config): # pragma: no coverage #NOSONAR
tempdir = tempfile.mkdtemp(config['paths']['temp_dir_name'])
output_path = os.path.expanduser(config['paths']['out'])

cr_api = api.ClashRoyaleAPI(config['api']['server_url'], config['api']['api_key'], config['api']['clan_id'])
cr_api = pyroyale.ClashRoyaleAPI(config['api']['server_url'], config['api']['api_key'], config['api']['clan_id'])

# Get clan data and war log from API.
clan = cr_api.get_clan()
Expand Down Expand Up @@ -615,21 +615,21 @@ def build_dashboard(config): # pragma: no coverage #NOSONAR
except FileExistsError as e:
logger.error('File Exists: could not write output to: \n\t{}'.format(e.filename))

except api.ClashRoyaleAPIAuthenticationError as e:
except pyroyale.ClashRoyaleAPIAuthenticationError as e:
msg = 'developer.clashroyale.com authentication error: {}'.format(e)
if not config['api']['api_key']:
msg += '\n - API key not provided'
else:
msg += '\n - API key not valid'
logger.error(msg)

except api.ClashRoyaleAPIClanNotFound as e:
except pyroyale.ClashRoyaleAPIClanNotFound as e:
logger.error('developer.clashroyale.com: {}'.format(e))

except api.ClashRoyaleAPIError as e:
except pyroyale.ClashRoyaleAPIError as e:
logger.error('developer.clashroyale.com error: {}'.format(e))

except api.ClashRoyaleAPIMissingFieldsError as e:
except pyroyale.ClashRoyaleAPIMissingFieldsError as e:
logger.error('error: {}'.format(e))

finally:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
# your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=['jinja2','configparser','requests'],
install_requires=['jinja2','configparser','pyroyale'],
tests_requires=['pytest','pytest-runner','coverage','requests_mock'],

include_package_data=True,
Expand Down
101 changes: 0 additions & 101 deletions tests/test_api.py

This file was deleted.

0 comments on commit 643ed6c

Please sign in to comment.