arkindex-client 1.0.14__py3-none-any.whl → 1.0.15__py3-none-any.whl

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.
arkindex/client.py CHANGED
@@ -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,
arkindex/pagination.py CHANGED
@@ -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
arkindex/transports.py CHANGED
@@ -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>
@@ -167,7 +167,7 @@ exception's attributes:
167
167
  except ErrorResponse as e:
168
168
  print(e.title) # "400 Bad Request"
169
169
  print(e.status_code) # 400
170
- print(e.result) # Any kind of response body the server might give
170
+ print(e.content) # Any kind of response body the server might give
171
171
 
172
172
  Note that by default, using ``repr()`` or ``str()`` on APIStar exceptions will
173
173
  not give any useful messages; a fix in APIStar is waiting to be merged. In
@@ -0,0 +1,11 @@
1
+ arkindex/__init__.py,sha256=OBw25Nwe6r1AN3a36-8lnUcDy3nkDIiebBgYNK2Zo9o,99
2
+ arkindex/auth.py,sha256=O45HgpsblBqNJr9nRALU14wZgCGcmCgcGjAoD0zAyrg,1073
3
+ arkindex/client.py,sha256=nTD_P4mjiyjKsgTprDFJbpswKDoZkGJTuxxrznkcZWc,10592
4
+ arkindex/exceptions.py,sha256=3jzuuXgsPA28qH7GMwPVQisWCvitAQtYiQ5uKxzFQ_M,155
5
+ arkindex/mock.py,sha256=hWU8EKfvVBAQ8VVI4Rgic809GLLDoh8Nvuvih54luKQ,2762
6
+ arkindex/pagination.py,sha256=CfcHtqJb9MtuCfZPMTLYCnXlPfHEG3nCurt7bCYEByg,8947
7
+ arkindex/transports.py,sha256=RmQ9fXdnLd6PizifyVI5E7QTIj3MU6Xua76jp87TKpM,464
8
+ arkindex_client-1.0.15.dist-info/METADATA,sha256=P1C2tmJTUnFpfrotrQewS1EBOzT62ISRGa6Q4OGIKDs,7027
9
+ arkindex_client-1.0.15.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
10
+ arkindex_client-1.0.15.dist-info/top_level.txt,sha256=iP1TxDW_jSDQA4FIcahBFXiDcZXqam2a_gFVnDbR3c4,9
11
+ arkindex_client-1.0.15.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- arkindex/__init__.py,sha256=OBw25Nwe6r1AN3a36-8lnUcDy3nkDIiebBgYNK2Zo9o,99
2
- arkindex/auth.py,sha256=O45HgpsblBqNJr9nRALU14wZgCGcmCgcGjAoD0zAyrg,1073
3
- arkindex/client.py,sha256=XKIb5vW8-VjFWBWnuE28zJm93qOEgKJ5fbTFHkBr1PU,10509
4
- arkindex/exceptions.py,sha256=3jzuuXgsPA28qH7GMwPVQisWCvitAQtYiQ5uKxzFQ_M,155
5
- arkindex/mock.py,sha256=hWU8EKfvVBAQ8VVI4Rgic809GLLDoh8Nvuvih54luKQ,2762
6
- arkindex/pagination.py,sha256=mOF2wI70lnXeF89j4UJnhTUoVN4c_CrtmIQvbz92YXA,8826
7
- arkindex/transports.py,sha256=cBnCQ1MPaBA163bAa3UAd7lUG-SFStYkOPajer_C_GM,298
8
- arkindex_client-1.0.14.dist-info/METADATA,sha256=ygwcQsFiag4sqnCwS8zupckWJEE26pUhxhWMMv5ysFI,7026
9
- arkindex_client-1.0.14.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
10
- arkindex_client-1.0.14.dist-info/top_level.txt,sha256=iP1TxDW_jSDQA4FIcahBFXiDcZXqam2a_gFVnDbR3c4,9
11
- arkindex_client-1.0.14.dist-info/RECORD,,