zipher-sdk 0.1.7__tar.gz → 0.2.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: zipher-sdk
3
- Version: 0.1.7
3
+ Version: 0.2.0
4
4
  Summary: Python SDK for programmatic access to the Zipher API
5
5
  Home-page: UNKNOWN
6
6
  Author: Zipher Inc.
@@ -8,7 +8,7 @@ with open('README.md', encoding='utf-8') as f:
8
8
 
9
9
  setup(
10
10
  name='zipher-sdk',
11
- version='0.1.7',
11
+ version='0.2.0',
12
12
  description='Python SDK for programmatic access to the Zipher API',
13
13
  long_description=long_description,
14
14
  long_description_content_type='text/markdown',
@@ -1,5 +1,8 @@
1
1
  import unittest
2
2
  from unittest.mock import patch, MagicMock
3
+
4
+ import requests.exceptions
5
+
3
6
  from zipher.client import Client
4
7
  from zipher.exceptions import MissingAPIKeyError
5
8
  from zipher.models import ConfFetcherRequest
@@ -39,6 +42,13 @@ class TestClient(unittest.TestCase):
39
42
  with self.assertRaises(ConnectionError):
40
43
  self.client.get_optimized_config(job_id="1234")
41
44
 
45
+ @patch('requests.get')
46
+ def test_api_error_on_cluster_update(self, mock_get):
47
+ mock_get.side_effect = requests.exceptions.ConnectionError
48
+ config_to_update = {'attr': 'value'}
49
+ res = self.client.update_existing_conf(job_id="1234", existing_conf=config_to_update)
50
+ self.assertDictEqual(config_to_update, res)
51
+
42
52
 
43
53
  if __name__ == '__main__':
44
54
  unittest.main()
@@ -42,4 +42,7 @@ class Client:
42
42
  if 'new_cluster' in existing_conf:
43
43
  existing_conf = existing_conf['new_cluster']
44
44
  params = ConfFetcherRequest(customer_id=self.customer_id, job_id=job_id, merge_with=json.dumps(existing_conf))
45
- return self._call_conf_fetcher_api(params)
45
+ try:
46
+ return self._call_conf_fetcher_api(params)
47
+ except:
48
+ return existing_conf
@@ -0,0 +1,6 @@
1
+
2
+
3
+
4
+ class Conf:
5
+ zipher_config_fetcher_api_endpoint = "https://api.zipher.cloud/default/get_clusterspec"
6
+ zipher_api_key_env_var = 'ZIPHER_API_KEY'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zipher-sdk
3
- Version: 0.1.7
3
+ Version: 0.2.0
4
4
  Summary: Python SDK for programmatic access to the Zipher API
5
5
  Home-page: UNKNOWN
6
6
  Author: Zipher Inc.
@@ -1,6 +0,0 @@
1
-
2
-
3
-
4
- class Conf:
5
- zipher_config_fetcher_api_endpoint = 'https://vrb1ii8ac9.execute-api.us-west-2.amazonaws.com/prod/fetch'
6
- zipher_api_key_env_var = 'ZIPHER_API_KEY'
File without changes
File without changes
File without changes
File without changes
File without changes