brynq-sdk-zermelo 2.1.0__tar.gz → 2.1.1__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: 1.0
2
2
  Name: brynq_sdk_zermelo
3
- Version: 2.1.0
3
+ Version: 2.1.1
4
4
  Summary: Zermelo wrapper from BrynQ
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -27,6 +27,7 @@ class Zermelo(BrynQ):
27
27
  self.storage_location = storage_location
28
28
  self.initial_zermelo_extract = initial_zermelo_extract
29
29
  self.debug = debug
30
+ self.timeout = 3600
30
31
  if extract_cancelled_appointments:
31
32
  self.cancelled_appointments = ''
32
33
  else:
@@ -139,7 +140,7 @@ class Zermelo(BrynQ):
139
140
 
140
141
  if nested:
141
142
  # Get the response without any transformation
142
- response = requests.get(url).json()['response']['data']
143
+ response = requests.get(url, timeout=self.timeout).json()['response']['data']
143
144
 
144
145
  # From all the fields, hold only the meta_fields (the not nested fields)
145
146
  meta_fields = fields.copy()
@@ -181,7 +182,7 @@ class Zermelo(BrynQ):
181
182
  df = pd.merge(df, df_temp, how='left', on=meta_fields)
182
183
  data = df
183
184
  else:
184
- init_response = json.loads(requests.get(url).content)
185
+ init_response = json.loads(requests.get(url, timeout=self.timeout).content)
185
186
  status = init_response['response']['status']
186
187
  if status == 200:
187
188
  data = pd.DataFrame(init_response['response']['data'])
@@ -232,7 +233,7 @@ class Zermelo(BrynQ):
232
233
  end_epoch = int(start_epoch + (3600 * 24 * 7))
233
234
 
234
235
  url = '{0}{1}?access_token={2}&fields={3}&start={4}&end={5}'.format(self.url, endpoint, self.access_token, fields, start_epoch, end_epoch)
235
- data = requests.get(url).json()['response']['data']
236
+ data = requests.get(url, timeout=self.timeout).json()['response']['data']
236
237
 
237
238
  # checks if data is not empty list
238
239
  if data:
@@ -274,7 +275,7 @@ class Zermelo(BrynQ):
274
275
  end_epoch = int(start_epoch + (3600 * 24 * 7))
275
276
  print(start_epoch, end_epoch)
276
277
  url = '{0}{1}?access_token={2}&fields={3}&start={4}&end={5}&includeHidden=True{6}&valid=True'.format(self.url, endpoint, self.access_token, fields, start_epoch, end_epoch, self.cancelled_appointments)
277
- data = requests.get(url).json()['response']['data']
278
+ data = requests.get(url, timeout=self.timeout).json()['response']['data']
278
279
 
279
280
  # checks if data is not empty list
280
281
  if data:
@@ -359,7 +360,7 @@ class Zermelo(BrynQ):
359
360
  try:
360
361
  # merge params with loop params
361
362
  time_params = params | {'start': start_epoch, 'end': end_epoch}
362
- resp = requests.get(url=url, params=time_params)
363
+ resp = requests.get(url=url, params=time_params, timeout=self.timeout)
363
364
  resp.raise_for_status()
364
365
 
365
366
  data = resp.json()['response']['data']
@@ -394,7 +395,7 @@ class Zermelo(BrynQ):
394
395
  start_epoch += (3600 * 24 * 7) # Skip this block to avoid infinite retry
395
396
  else:
396
397
  try:
397
- resp = requests.get(url=url, params=params)
398
+ resp = requests.get(url=url, params=params, timeout=self.timeout)
398
399
  resp.raise_for_status()
399
400
  data = resp.json()['response']['data']
400
401
  df = pd.DataFrame(data)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: brynq-sdk-zermelo
3
- Version: 2.1.0
3
+ Version: 2.1.1
4
4
  Summary: Zermelo wrapper from BrynQ
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
2
2
 
3
3
  setup(
4
4
  name='brynq_sdk_zermelo',
5
- version='2.1.0',
5
+ version='2.1.1',
6
6
  description='Zermelo wrapper from BrynQ',
7
7
  long_description='Zermelo wrapper from BrynQ',
8
8
  author='BrynQ',