hakai_api 1.2.0__tar.gz → 1.3.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hakai_api
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: Get Hakai database resources using http calls
5
5
  Home-page: https://github.com/HakaiInstitute/hakai-api-client-python
6
6
  Author: Taylor Denouden
@@ -5,12 +5,11 @@ Last updated: April 2021
5
5
  """
6
6
 
7
7
  import os
8
- import pickle
8
+ import json
9
9
  from datetime import datetime
10
10
  from time import mktime, sleep
11
11
  from typing import Dict, Union
12
12
 
13
- from pytz import utc
14
13
  from requests_oauthlib import OAuth2Session
15
14
 
16
15
 
@@ -68,8 +67,8 @@ class Client(OAuth2Session):
68
67
 
69
68
  def _save_credentials(self, credentials: Dict):
70
69
  """Save the credentials object to a file."""
71
- with open(self._credentials_file, "wb") as outfile:
72
- pickle.dump(credentials, outfile)
70
+ with open(self._credentials_file, "w") as outfile:
71
+ json.dump(credentials, outfile)
73
72
 
74
73
  def _try_to_load_credentials_file(self) -> Union[Dict, bool]:
75
74
  """Try to load the cached credentials file."""
@@ -78,7 +77,7 @@ class Client(OAuth2Session):
78
77
 
79
78
  with open(self._credentials_file, "rb") as infile:
80
79
  try:
81
- credentials = pickle.load(infile)
80
+ credentials = json.load(infile)
82
81
  expires_at = int(credentials["expires_at"])
83
82
  except (KeyError, ValueError):
84
83
  os.remove(self._credentials_file)
@@ -86,8 +85,8 @@ class Client(OAuth2Session):
86
85
 
87
86
  now = int(
88
87
  (
89
- mktime(datetime.now(tz=utc).timetuple())
90
- + datetime.now(tz=utc).microsecond / 1000000.0
88
+ mktime(datetime.now().timetuple())
89
+ + datetime.now().microsecond / 1000000.0
91
90
  )
92
91
  ) # utc timestamp
93
92
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hakai-api
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: Get Hakai database resources using http calls
5
5
  Home-page: https://github.com/HakaiInstitute/hakai-api-client-python
6
6
  Author: Taylor Denouden
File without changes
File without changes
File without changes