Skip to content

Commit

Permalink
Merge pull request #37 from eodms-sgdot/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
keballantyne committed Sep 28, 2023
2 parents 724400b + 480faa9 commit 5d566ee
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 29 deletions.
2 changes: 1 addition & 1 deletion eodms_rapi/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.6.0'
__version__ = '1.6.1'
26 changes: 5 additions & 21 deletions eodms_rapi/eodms.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
##############################################################################
# MIT License
#
#
# Copyright (c) His Majesty the King in Right of Canada, as
# represented by the Minister of Natural Resources, 2023
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# Licensed under the MIT license
# (see LICENSE or <http://opensource.org/licenses/MIT>) All files in the
# project carrying such notice may not be copied, modified, or distributed
# except according to those terms.
#
##############################################################################



import os
import requests
import logging.config
Expand Down
6 changes: 3 additions & 3 deletions eodms_rapi/rapi_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def submit(self, query_url, request_type='get', post_data=None,
err = out_msg
query_err = QueryError(err)

return query_err if self._check_auth(query_err) \
return query_err if self.eodms._check_auth(query_err) \
else query_err

if attempt < self.attempts:
Expand Down Expand Up @@ -300,7 +300,7 @@ def submit(self, query_url, request_type='get', post_data=None,
if err is not None:
query_err = QueryError(err)

return None if self._check_auth(query_err) else query_err
return None if self.eodms._check_auth(query_err) else query_err
# If no results from RAPI, return None
if res is None:
return None
Expand All @@ -310,7 +310,7 @@ def submit(self, query_url, request_type='get', post_data=None,
except_err = self._get_exception(res)

if isinstance(except_err, QueryError):
if self._check_auth(except_err):
if self.eodms._check_auth(except_err):
return None

self.eodms.log_msg(msg, 'warning')
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = py-eodms-rapi
version = 1.6.0
version = 1.6.1
author = Kevin Ballantyne (Natural Resources Canada)
author_email = kevin.ballantyne@nrcan-rncan.gc.ca
description = EODMS RAPI Client is a Python3 package used to access the REST API service provided by the Earth Observation Data Management System (EODMS) from Natural Resources Canada.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='py-eodms-rapi',
version='1.6.0',
version='1.6.1',
author='Kevin Ballantyne (Natural Resources Canada)',
author_email='kevin.ballantyne@nrcan-rncan.gc.ca',
packages=find_packages(),
Expand Down
9 changes: 7 additions & 2 deletions test/test_pyeodmsrapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# MIT License
#
# Copyright (c) His Majesty the King in Right of Canada, as
# represented by the Minister of Natural Resources, 2022.
# represented by the Minister of Natural Resources, 2023.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand All @@ -27,7 +27,7 @@
__title__ = 'py-eodms-rapi Tester'
__author__ = 'Kevin Ballantyne'
__copyright__ = 'Copyright (c) His Majesty the King in Right of Canada, ' \
'as represented by the Minister of Natural Resources, 2022'
'as represented by the Minister of Natural Resources, 2023'
__license__ = 'MIT License'
__description__ = 'Performs various tests of the py-eodms-rapi Python package.'
__email__ = 'eodms-sgdot@nrcan-rncan.gc.ca'
Expand Down Expand Up @@ -180,5 +180,10 @@ def test_multiple_searches(self):
res = rapi.get_results('full')
print(f"Number of results: {len(res)}")

def test_wrong_creds(self):
rapi = eodms_rapi.EODMSRAPI('dflgkhdfgjkh', 'sdfglkdfhgjkf')

colls = rapi.get_collections()

if __name__ == '__main__':
unittest.main()

0 comments on commit 5d566ee

Please sign in to comment.