arkindex-client 1.0.14__tar.gz → 1.0.15__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.
Files changed (20) hide show
  1. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/PKG-INFO +2 -2
  2. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/README.rst +1 -1
  3. arkindex-client-1.0.15/VERSION +1 -0
  4. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/arkindex/client.py +4 -2
  5. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/arkindex/pagination.py +3 -2
  6. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/arkindex/transports.py +5 -0
  7. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/arkindex_client.egg-info/PKG-INFO +2 -2
  8. arkindex-client-1.0.14/VERSION +0 -1
  9. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/MANIFEST.in +0 -0
  10. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/arkindex/__init__.py +0 -0
  11. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/arkindex/auth.py +0 -0
  12. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/arkindex/exceptions.py +0 -0
  13. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/arkindex/mock.py +0 -0
  14. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/arkindex_client.egg-info/SOURCES.txt +0 -0
  15. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/arkindex_client.egg-info/dependency_links.txt +0 -0
  16. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/arkindex_client.egg-info/requires.txt +0 -0
  17. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/arkindex_client.egg-info/top_level.txt +0 -0
  18. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/requirements.txt +0 -0
  19. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/setup.cfg +0 -0
  20. {arkindex-client-1.0.14 → arkindex-client-1.0.15}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arkindex-client
3
- Version: 1.0.14
3
+ Version: 1.0.15
4
4
  Summary: API client for the Arkindex project
5
5
  Home-page: https://gitlab.teklia.com/arkindex/api-client
6
6
  Author: Teklia <contact@teklia.com>
@@ -164,7 +164,7 @@ exception's attributes:
164
164
  except ErrorResponse as e:
165
165
  print(e.title) # "400 Bad Request"
166
166
  print(e.status_code) # 400
167
- print(e.result) # Any kind of response body the server might give
167
+ print(e.content) # Any kind of response body the server might give
168
168
 
169
169
  Note that by default, using ``repr()`` or ``str()`` on APIStar exceptions will
170
170
  not give any useful messages; a fix in APIStar is waiting to be merged. In
@@ -142,7 +142,7 @@ exception's attributes:
142
142
  except ErrorResponse as e:
143
143
  print(e.title) # "400 Bad Request"
144
144
  print(e.status_code) # 400
145
- print(e.result) # Any kind of response body the server might give
145
+ print(e.content) # Any kind of response body the server might give
146
146
 
147
147
  Note that by default, using ``repr()`` or ``str()`` on APIStar exceptions will
148
148
  not give any useful messages; a fix in APIStar is waiting to be merged. In
@@ -0,0 +1 @@
1
+ 1.0.15
@@ -84,6 +84,7 @@ class ArkindexClient(apistar.Client):
84
84
  schema_url=None,
85
85
  csrf_cookie=None,
86
86
  sleep=0,
87
+ verify=True,
87
88
  **kwargs,
88
89
  ):
89
90
  r"""
@@ -103,6 +104,7 @@ class ArkindexClient(apistar.Client):
103
104
  if not schema_url:
104
105
  schema_url = urljoin(base_url, SCHEMA_ENDPOINT)
105
106
 
107
+ self.verify = verify
106
108
  try:
107
109
  split = urlsplit(schema_url)
108
110
  if split.scheme == "file" or not (split.scheme or split.netloc):
@@ -110,7 +112,7 @@ class ArkindexClient(apistar.Client):
110
112
  with open(schema_url) as f:
111
113
  schema = yaml.safe_load(f)
112
114
  else:
113
- resp = requests.get(schema_url)
115
+ resp = requests.get(schema_url, verify=self.verify)
114
116
  resp.raise_for_status()
115
117
  schema = yaml.safe_load(resp.content)
116
118
  except Exception as e:
@@ -173,7 +175,7 @@ class ArkindexClient(apistar.Client):
173
175
  )
174
176
 
175
177
  def init_transport(self, *args, **kwargs):
176
- return ArkindexHTTPTransport(*args, **kwargs)
178
+ return ArkindexHTTPTransport(self.verify, *args, **kwargs)
177
179
 
178
180
  def configure(
179
181
  self,
@@ -117,9 +117,10 @@ class ResponsePaginator(Sized, Iterator):
117
117
  if "with_count" in operation_fields:
118
118
  extra_kwargs["with_count"] = "true"
119
119
  else:
120
+ remaining_count = self.pages_count - self.pages_loaded
120
121
  logger.info(
121
122
  f"Loading {self.mode.value} {index} on try {self.retries - retry + 1}/{self.retries}"
122
- f" - remains {self.pages_count - self.pages_loaded} pages to load."
123
+ f" - remains {remaining_count} page{'s' if remaining_count > 1 else ''} to load."
123
124
  )
124
125
 
125
126
  # Fetch the next page
@@ -147,7 +148,7 @@ class ResponsePaginator(Sized, Iterator):
147
148
  return False
148
149
  self.pages_count = math.ceil(self.count / len(self.results))
149
150
  logger.info(
150
- f"Pagination will load a total of {self.pages_count} pages."
151
+ f"Pagination will load a total of {self.pages_count} page{'s' if self.pages_count > 1 else ''}."
151
152
  )
152
153
  if self.mode == PaginationMode.PageNumber:
153
154
  # Initialize all pages once
@@ -3,7 +3,12 @@ from apistar.client.transports import HTTPTransport
3
3
 
4
4
 
5
5
  class ArkindexHTTPTransport(HTTPTransport):
6
+ def __init__(self, verify=True, *args, **kwargs):
7
+ super().__init__(*args, **kwargs)
8
+ self.verify = verify
9
+
6
10
  def get_request_options(self, *args, **kwargs):
7
11
  options = super().get_request_options(*args, **kwargs)
8
12
  options["timeout"] = (30, 60)
13
+ options["verify"] = self.verify
9
14
  return options
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arkindex-client
3
- Version: 1.0.14
3
+ Version: 1.0.15
4
4
  Summary: API client for the Arkindex project
5
5
  Home-page: https://gitlab.teklia.com/arkindex/api-client
6
6
  Author: Teklia <contact@teklia.com>
@@ -164,7 +164,7 @@ exception's attributes:
164
164
  except ErrorResponse as e:
165
165
  print(e.title) # "400 Bad Request"
166
166
  print(e.status_code) # 400
167
- print(e.result) # Any kind of response body the server might give
167
+ print(e.content) # Any kind of response body the server might give
168
168
 
169
169
  Note that by default, using ``repr()`` or ``str()`` on APIStar exceptions will
170
170
  not give any useful messages; a fix in APIStar is waiting to be merged. In
@@ -1 +0,0 @@
1
- 1.0.14