[Git][debian-gis-team/usgs][upstream] New upstream version 0.3.6

Antonio Valentino (@antonio.valentino) gitlab at salsa.debian.org
Sun Aug 10 18:07:05 BST 2025



Antonio Valentino pushed to branch upstream at Debian GIS Project / usgs


Commits:
4ddef38e by Antonio Valentino at 2025-08-09T14:19:38+00:00
New upstream version 0.3.6
- - - - -


18 changed files:

- − PKG-INFO
- requirements.txt
- setup.cfg
- setup.py
- tests/create_snapshots.py
- tests/test_api.py
- tests/test_payloads.py
- − usgs.egg-info/PKG-INFO
- − usgs.egg-info/SOURCES.txt
- − usgs.egg-info/dependency_links.txt
- − usgs.egg-info/entry_points.txt
- − usgs.egg-info/not-zip-safe
- − usgs.egg-info/requires.txt
- − usgs.egg-info/top_level.txt
- usgs/__init__.py
- usgs/api.py
- usgs/payloads.py
- usgs/scripts/cli.py


Changes:

=====================================
PKG-INFO deleted
=====================================
@@ -1,10 +0,0 @@
-Metadata-Version: 2.1
-Name: usgs
-Version: 0.3.5
-Summary: Access the USGS inventory service
-Home-page: https://github.com/kapadia/usgs
-Author: Amit Kapadia
-Author-email: amit at planet.com
-License: MIT
-Provides-Extra: test
-License-File: LICENSE


=====================================
requirements.txt
=====================================
@@ -1,4 +1,3 @@
-mock==1.3.0
 pytest==2.8.7
 click>=4.0
 requests>=2.7.0


=====================================
setup.cfg
=====================================
@@ -1,7 +1,2 @@
 [upload]
-dry-run = 0
-
-[egg_info]
-tag_build = 
-tag_date = 0
-
+dry-run = 0
\ No newline at end of file


=====================================
setup.py
=====================================
@@ -19,7 +19,7 @@ setup(name='usgs',
       author=u"Amit Kapadia",
       author_email='amit at planet.com',
       url='https://github.com/kapadia/usgs',
-      license='MIT',
+      license='ISC',
       packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
       include_package_data=True,
       package_data={'usgs': ['data/datasets.json']},
@@ -30,7 +30,7 @@ setup(name='usgs',
           'requests_futures>=0.9.5'
       ],
       extras_require={
-          'test': ['pytest', 'mock'],
+          'test': ['pytest'],
       },
       entry_points="""
       [console_scripts]


=====================================
tests/create_snapshots.py
=====================================
@@ -17,7 +17,7 @@ def create_snapshots():
     Run requests against USGS API for use in tests.
     """
 
-    api_key = api.login(os.environ['USGS_USERNAME'], os.environ['USGS_PASSWORD'])
+    api_key = api.login(os.environ['USGS_USERNAME'], os.environ['USGS_TOKEN'])
 
     # Dataset Fields
     response = api.dataset_fields("LANDSAT_8_C1", "EE", api_key=api_key)


=====================================
tests/test_api.py
=====================================
@@ -1,5 +1,5 @@
 import pytest
-import mock
+from unittest import mock
 
 from usgs import api
 from .MockPost import MockPost
@@ -110,4 +110,4 @@ def test_scene_search():
     assert len(response['data']["results"]) == 1
 
     for expected_key in expected_keys:
-        assert expected_key in response['data']["results"][0]
\ No newline at end of file
+        assert expected_key in response['data']["results"][0]


=====================================
tests/test_payloads.py
=====================================
@@ -54,8 +54,8 @@ class PayloadsTest(unittest.TestCase):
 
     
     def test_login(self):
-        expected = """{"username": "username", "password": "password"}"""
-        payload = payloads.login("username", "password")
+        expected = """{"username": "username", "token": "token"}"""
+        payload = payloads.login("username", "token")
         assert compare_json(payload, expected)
 
 


=====================================
usgs.egg-info/PKG-INFO deleted
=====================================
@@ -1,10 +0,0 @@
-Metadata-Version: 2.1
-Name: usgs
-Version: 0.3.5
-Summary: Access the USGS inventory service
-Home-page: https://github.com/kapadia/usgs
-Author: Amit Kapadia
-Author-email: amit at planet.com
-License: MIT
-Provides-Extra: test
-License-File: LICENSE


=====================================
usgs.egg-info/SOURCES.txt deleted
=====================================
@@ -1,45 +0,0 @@
-.gitignore
-.travis.yml
-LICENSE
-README.rst
-requirements.txt
-setup.cfg
-setup.py
-docs/Makefile
-docs/conf.py
-docs/index.rst
-docs/reference/api.rst
-docs/reference/cli.rst
-docs/reference/payloads.rst
-docs/reference/catalog/cwic.rst
-docs/reference/catalog/ee.rst
-docs/reference/catalog/hdds.rst
-docs/reference/catalog/lpcs.rst
-scripts/get_datasets_in_node.py
-tests/MockPost.py
-tests/__init__.py
-tests/create_snapshots.py
-tests/test_api.py
-tests/test_cli.py
-tests/test_payloads.py
-tests/data/dataset-download-options.json
-tests/data/dataset-fields.json
-tests/data/dataset-search.json
-tests/data/download-options.json
-tests/data/download-request.json
-tests/data/scene-metadata.json
-tests/data/scene-search.json
-usgs/__init__.py
-usgs/api.py
-usgs/payloads.py
-usgs/xsi.py
-usgs.egg-info/PKG-INFO
-usgs.egg-info/SOURCES.txt
-usgs.egg-info/dependency_links.txt
-usgs.egg-info/entry_points.txt
-usgs.egg-info/not-zip-safe
-usgs.egg-info/requires.txt
-usgs.egg-info/top_level.txt
-usgs/data/datasets.json
-usgs/scripts/__init__.py
-usgs/scripts/cli.py
\ No newline at end of file


=====================================
usgs.egg-info/dependency_links.txt deleted
=====================================
@@ -1 +0,0 @@
-


=====================================
usgs.egg-info/entry_points.txt deleted
=====================================
@@ -1,2 +0,0 @@
-[console_scripts]
-usgs = usgs.scripts.cli:usgs


=====================================
usgs.egg-info/not-zip-safe deleted
=====================================
@@ -1 +0,0 @@
-


=====================================
usgs.egg-info/requires.txt deleted
=====================================
@@ -1,7 +0,0 @@
-click>=4.0
-requests>=2.7.0
-requests_futures>=0.9.5
-
-[test]
-pytest
-mock


=====================================
usgs.egg-info/top_level.txt deleted
=====================================
@@ -1 +0,0 @@
-usgs


=====================================
usgs/__init__.py
=====================================
@@ -1,5 +1,4 @@
-
-__version__ = "0.3.5"
+__version__ = "0.3.6"
 
 # The USGS API endpoint
 USGS_API_DEPRECATED = "https://earthexplorer.usgs.gov/inventory/json/v/1.4.0"
@@ -17,17 +16,22 @@ EARTH_EXPLORER_CATALOG_NODE = "EE"
 # http://hddsexplorer.usgs.gov/
 HDDS_EXPLORER_CATALOG_NODE = "HDDS"
 
+
 class USGSError(Exception):
     pass
 
+
 class USGSApiKeyRequiredError(Exception):
     pass
 
+
 class USGSAmbiguousNode(Exception):
     pass
 
+
 class USGSDependencyRequired(ImportError):
     pass
 
+
 class USGSAuthExpiredError(Exception):
     pass


=====================================
usgs/api.py
=====================================
@@ -136,19 +136,19 @@ def dataset_search(dataset=None, catalog=None, ll=None, ur=None, start_date=None
 
     return response
 
-def login(username, password, save=True):
+def login(username, token, save=True):
     """
     Log in, creating a temporary API key and optionally storing it for later use.
 
     :param str username: Username of the USGS account to log in with.
-    :param str password: Password of the USGS account to log in with.
+    :param str token: Application Token of the USGS account to log in with.
     :param bool save: If true, the API key will be stored in a local file (~/.usgs)
         until `api.logout` is called to remove it. The stored key will be used by
         other functions to authenticate requests whenever an API key is not explicitly
         provided.
     """
-    url = '{}/login'.format(USGS_API)
-    payload = payloads.login(username, password)
+    url = '{}/login-token'.format(USGS_API)
+    payload = payloads.login(username, token)
 
     with _create_session(api_key=None) as session:
         created = datetime.now().isoformat()


=====================================
usgs/payloads.py
=====================================
@@ -124,18 +124,18 @@ def dataset_search(dataset, catalog, start_date=None, end_date=None, ll=None, ur
 
     return json.dumps(payload)
 
-def login(username, password):
+def login(username, token):
     """
     Upon a successful login, an API key will be returned. This key will be active
     for two hours and should be destroyed upon final use of the service by calling
     the logout method.
 
     :param str username:
-    :param str password:
+    :param str token:
     """
     payload = {
         "username": username,
-        "password": password
+        "token": token
     }
 
     return json.dumps(payload)


=====================================
usgs/scripts/cli.py
=====================================
@@ -84,8 +84,8 @@ def usgs():
 
 @click.command()
 @click.argument("username", envvar='USGS_USERNAME')
- at click.argument("password", envvar='USGS_PASSWORD')
-def cycle_token(username, password):
+ at click.argument("token", envvar='USGS_TOKEN')
+def cycle_token(username, token):
 
     credential_filepath = os.path.join(os.path.expanduser("~"), ".usgs")
     with open(credential_filepath) as f:
@@ -97,7 +97,7 @@ def cycle_token(username, password):
     click.echo('The token lifetime is {} seconds'.format(token_lifetime))
     if token_lifetime > approx_two_hours:
         api.logout()
-        api.login(username, password)
+        api.login(username, token)
 
 
 @click.command()
@@ -139,9 +139,9 @@ def download_request(dataset, entity_id, product_id, api_key):
 
 @click.command()
 @click.argument("username", envvar='USGS_USERNAME')
- at click.argument("password", envvar='USGS_PASSWORD')
-def login(username, password):
-    click.echo(api.login(username, password))
+ at click.argument("token", envvar='USGS_TOKEN')
+def login(username, token):
+    click.echo(api.login(username, token))
 
 
 @click.command()



View it on GitLab: https://salsa.debian.org/debian-gis-team/usgs/-/commit/4ddef38ed4d76174e665c3ce05339539c9caa73c

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/usgs/-/commit/4ddef38ed4d76174e665c3ce05339539c9caa73c
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20250810/224051bf/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list