hakai_api 1.1.0__tar.gz → 1.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hakai_api-1.1.2/PKG-INFO +68 -0
- {hakai_api-1.1.0 → hakai_api-1.1.2}/hakai_api/Client.py +1 -1
- {hakai_api-1.1.0 → hakai_api-1.1.2}/hakai_api/__init__.py +1 -1
- hakai_api-1.1.2/hakai_api.egg-info/PKG-INFO +68 -0
- {hakai_api-1.1.0 → hakai_api-1.1.2}/hakai_api.egg-info/SOURCES.txt +0 -2
- hakai_api-1.1.2/setup.cfg +4 -0
- {hakai_api-1.1.0 → hakai_api-1.1.2}/setup.py +7 -6
- hakai_api-1.1.0/PKG-INFO +0 -10
- hakai_api-1.1.0/hakai_api.egg-info/PKG-INFO +0 -10
- hakai_api-1.1.0/hakai_api.egg-info/not-zip-safe +0 -1
- hakai_api-1.1.0/setup.cfg +0 -7
- {hakai_api-1.1.0 → hakai_api-1.1.2}/README.md +0 -0
- {hakai_api-1.1.0 → hakai_api-1.1.2}/hakai_api.egg-info/dependency_links.txt +0 -0
- {hakai_api-1.1.0 → hakai_api-1.1.2}/hakai_api.egg-info/requires.txt +0 -0
- {hakai_api-1.1.0 → hakai_api-1.1.2}/hakai_api.egg-info/top_level.txt +0 -0
hakai_api-1.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: hakai_api
|
|
3
|
+
Version: 1.1.2
|
|
4
|
+
Summary: Get Hakai database resources using http calls
|
|
5
|
+
Home-page: https://github.com/HakaiInstitute/hakai-api-client-python
|
|
6
|
+
Author: Taylor Denouden
|
|
7
|
+
Author-email: taylor.denouden@hakai.org
|
|
8
|
+
License: MIT
|
|
9
|
+
Description: # Hakai Api Python Client
|
|
10
|
+
|
|
11
|
+
This project exports a single Python class that can be used to make HTTP requests to the Hakai API resource server.
|
|
12
|
+
The exported `Client` class extends the functionality of the Python [requests library](https://docs.python-requests.org/en/master/) to supply Hakai OAuth2 credentials with url requests.
|
|
13
|
+
|
|
14
|
+
# Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install hakai-api
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
# Requirements
|
|
21
|
+
Python 3.6 or higher
|
|
22
|
+
|
|
23
|
+
# Quickstart
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from hakai_api import Client
|
|
27
|
+
|
|
28
|
+
# Get the api request client
|
|
29
|
+
client = Client() # Follow stdout prompts to get an API token
|
|
30
|
+
|
|
31
|
+
# Make a data request for chlorophyll data
|
|
32
|
+
url = '%s/%s' % (client.api_root, 'eims/views/output/chlorophyll?limit=50')
|
|
33
|
+
response = client.get(url)
|
|
34
|
+
|
|
35
|
+
print(url) # https://hecate.hakai.org/api/eims/views/output/chlorophyll...
|
|
36
|
+
print(response.json()) # [{'action': '', 'event_pk': 7064, 'rn': '1', 'date': '2012-05-17', 'work_area': 'CALVERT'...
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
# Methods
|
|
40
|
+
|
|
41
|
+
This library exports a single client name `Client`. Instantiating this class produces a `requests.Session` client from the Python requests library. The Hakai API Python Client inherits directly from `requests.Session` thus all methods available on that parent class are available. For details see the [requests documentation](http://docs.python-requests.org/).
|
|
42
|
+
|
|
43
|
+
The hakai_api `Client` class also contains a property `api_root` which is useful for constructing urls to access data from the API. The above [Quickstart example](#quickstart) demonstrates using this property to construct a url to access project names.
|
|
44
|
+
|
|
45
|
+
# API endpoints
|
|
46
|
+
|
|
47
|
+
For details about the API, including available endpoints where data can be requested from, see the [Hakai API documentation](https://github.com/HakaiInstitute/hakai-api).
|
|
48
|
+
|
|
49
|
+
# Advanced usage
|
|
50
|
+
|
|
51
|
+
You can specify which API to access when instantiating the Client. By default, the API uses `https://hecate.hakai.org/api` as the API root. It may be useful to use this library to access a locally running API instance or to access the Goose API for testing purposes. If you are always going to be accessing data from a locally running API instance, you are better off using the requests.py library directly since Authorization is not required for local requests.
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
# Get a client for a locally running API instance
|
|
55
|
+
client = Client("http://localhost:8666")
|
|
56
|
+
print(client.api_root) # http://localhost:8666
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
# Development
|
|
60
|
+
The business code for this package is in the file [`hakai_api/Client.py`](hakai_api/Client.py).
|
|
61
|
+
The `./setup.py` file is important for giving details about how to install the package when users do `pip install hakai-api`.
|
|
62
|
+
|
|
63
|
+
To build a new PyPi package version push a tag matching the pattern `v[0-9]+.[0-9]+.[0-9]+` or `v[0-9]+.[0-9]+.[0-9]+rc[0-9]+` to the origin (e.g. `v0.4.1` or `v0.5.2rc1`).
|
|
64
|
+
Github Actions should take care of packaging and pushing it to Hakai's PyPi repository from there.
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
Platform: UNKNOWN
|
|
68
|
+
Description-Content-Type: text/markdown
|
|
@@ -70,7 +70,7 @@ class Client(OAuth2Session):
|
|
|
70
70
|
with open(self._credentials_file, 'rb') as infile:
|
|
71
71
|
try:
|
|
72
72
|
credentials = pickle.load(infile)
|
|
73
|
-
expires_at = credentials['expires_at']
|
|
73
|
+
expires_at = int(credentials['expires_at'])
|
|
74
74
|
except (KeyError, ValueError):
|
|
75
75
|
os.remove(self._credentials_file)
|
|
76
76
|
return False
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
from hakai_api.Client import Client
|
|
2
|
-
|
|
2
|
+
__all__ = [Client]
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: hakai-api
|
|
3
|
+
Version: 1.1.2
|
|
4
|
+
Summary: Get Hakai database resources using http calls
|
|
5
|
+
Home-page: https://github.com/HakaiInstitute/hakai-api-client-python
|
|
6
|
+
Author: Taylor Denouden
|
|
7
|
+
Author-email: taylor.denouden@hakai.org
|
|
8
|
+
License: MIT
|
|
9
|
+
Description: # Hakai Api Python Client
|
|
10
|
+
|
|
11
|
+
This project exports a single Python class that can be used to make HTTP requests to the Hakai API resource server.
|
|
12
|
+
The exported `Client` class extends the functionality of the Python [requests library](https://docs.python-requests.org/en/master/) to supply Hakai OAuth2 credentials with url requests.
|
|
13
|
+
|
|
14
|
+
# Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install hakai-api
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
# Requirements
|
|
21
|
+
Python 3.6 or higher
|
|
22
|
+
|
|
23
|
+
# Quickstart
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from hakai_api import Client
|
|
27
|
+
|
|
28
|
+
# Get the api request client
|
|
29
|
+
client = Client() # Follow stdout prompts to get an API token
|
|
30
|
+
|
|
31
|
+
# Make a data request for chlorophyll data
|
|
32
|
+
url = '%s/%s' % (client.api_root, 'eims/views/output/chlorophyll?limit=50')
|
|
33
|
+
response = client.get(url)
|
|
34
|
+
|
|
35
|
+
print(url) # https://hecate.hakai.org/api/eims/views/output/chlorophyll...
|
|
36
|
+
print(response.json()) # [{'action': '', 'event_pk': 7064, 'rn': '1', 'date': '2012-05-17', 'work_area': 'CALVERT'...
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
# Methods
|
|
40
|
+
|
|
41
|
+
This library exports a single client name `Client`. Instantiating this class produces a `requests.Session` client from the Python requests library. The Hakai API Python Client inherits directly from `requests.Session` thus all methods available on that parent class are available. For details see the [requests documentation](http://docs.python-requests.org/).
|
|
42
|
+
|
|
43
|
+
The hakai_api `Client` class also contains a property `api_root` which is useful for constructing urls to access data from the API. The above [Quickstart example](#quickstart) demonstrates using this property to construct a url to access project names.
|
|
44
|
+
|
|
45
|
+
# API endpoints
|
|
46
|
+
|
|
47
|
+
For details about the API, including available endpoints where data can be requested from, see the [Hakai API documentation](https://github.com/HakaiInstitute/hakai-api).
|
|
48
|
+
|
|
49
|
+
# Advanced usage
|
|
50
|
+
|
|
51
|
+
You can specify which API to access when instantiating the Client. By default, the API uses `https://hecate.hakai.org/api` as the API root. It may be useful to use this library to access a locally running API instance or to access the Goose API for testing purposes. If you are always going to be accessing data from a locally running API instance, you are better off using the requests.py library directly since Authorization is not required for local requests.
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
# Get a client for a locally running API instance
|
|
55
|
+
client = Client("http://localhost:8666")
|
|
56
|
+
print(client.api_root) # http://localhost:8666
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
# Development
|
|
60
|
+
The business code for this package is in the file [`hakai_api/Client.py`](hakai_api/Client.py).
|
|
61
|
+
The `./setup.py` file is important for giving details about how to install the package when users do `pip install hakai-api`.
|
|
62
|
+
|
|
63
|
+
To build a new PyPi package version push a tag matching the pattern `v[0-9]+.[0-9]+.[0-9]+` or `v[0-9]+.[0-9]+.[0-9]+rc[0-9]+` to the origin (e.g. `v0.4.1` or `v0.5.2rc1`).
|
|
64
|
+
Github Actions should take care of packaging and pushing it to Hakai's PyPi repository from there.
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
Platform: UNKNOWN
|
|
68
|
+
Description-Content-Type: text/markdown
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
README.md
|
|
2
|
-
setup.cfg
|
|
3
2
|
setup.py
|
|
4
3
|
hakai_api/Client.py
|
|
5
4
|
hakai_api/__init__.py
|
|
6
5
|
hakai_api.egg-info/PKG-INFO
|
|
7
6
|
hakai_api.egg-info/SOURCES.txt
|
|
8
7
|
hakai_api.egg-info/dependency_links.txt
|
|
9
|
-
hakai_api.egg-info/not-zip-safe
|
|
10
8
|
hakai_api.egg-info/requires.txt
|
|
11
9
|
hakai_api.egg-info/top_level.txt
|
|
@@ -4,17 +4,18 @@ from setuptools import setup
|
|
|
4
4
|
|
|
5
5
|
setup(
|
|
6
6
|
name='hakai_api',
|
|
7
|
-
|
|
8
|
-
version=os.environ['VERSION'],
|
|
9
|
-
description='Get Hakai database resources using http calls',
|
|
10
|
-
url='https://github.com/tayden/hakai-api-client-python',
|
|
7
|
+
url='https://github.com/HakaiInstitute/hakai-api-client-python',
|
|
11
8
|
author='Taylor Denouden',
|
|
12
9
|
author_email='taylor.denouden@hakai.org',
|
|
13
|
-
|
|
10
|
+
packages=['hakai_api'],
|
|
14
11
|
install_requires=[
|
|
15
12
|
'pytz',
|
|
16
13
|
'requests',
|
|
17
14
|
'requests-oauthlib',
|
|
18
15
|
],
|
|
19
|
-
|
|
16
|
+
version=os.getenv('VERSION', '1.0.0.dev1'),
|
|
17
|
+
license='MIT',
|
|
18
|
+
description='Get Hakai database resources using http calls',
|
|
19
|
+
long_description=open('README.md').read(),
|
|
20
|
+
long_description_content_type="text/markdown"
|
|
20
21
|
)
|
hakai_api-1.1.0/PKG-INFO
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 1.0
|
|
2
|
-
Name: hakai_api
|
|
3
|
-
Version: 1.1.0
|
|
4
|
-
Summary: Get Hakai database resources using http calls
|
|
5
|
-
Home-page: https://github.com/tayden/hakai-api-client-python
|
|
6
|
-
Author: Taylor Denouden
|
|
7
|
-
Author-email: taylor.denouden@hakai.org
|
|
8
|
-
License: MIT
|
|
9
|
-
Description: UNKNOWN
|
|
10
|
-
Platform: UNKNOWN
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 1.0
|
|
2
|
-
Name: hakai-api
|
|
3
|
-
Version: 1.1.0
|
|
4
|
-
Summary: Get Hakai database resources using http calls
|
|
5
|
-
Home-page: https://github.com/tayden/hakai-api-client-python
|
|
6
|
-
Author: Taylor Denouden
|
|
7
|
-
Author-email: taylor.denouden@hakai.org
|
|
8
|
-
License: MIT
|
|
9
|
-
Description: UNKNOWN
|
|
10
|
-
Platform: UNKNOWN
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
hakai_api-1.1.0/setup.cfg
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|