pyxetabase 3.1.0.dev5__py3-none-any.whl → 3.1.0.dev7__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.

Potentially problematic release.


This version of pyxetabase might be problematic. Click here for more details.

pyopencga/commons.py CHANGED
@@ -145,22 +145,22 @@ def _fetch(config, sid, category, resource, method, subcategory=None, query_id=N
145
145
  # Getting REST response
146
146
  if method == 'get':
147
147
  try:
148
- r = requests.get(url, headers=header, cookies=config.cookies)
148
+ r = requests.get(url, headers=header, cookies=config.cookies, verify=not config.tlsAllowInvalidCertificates)
149
149
  except requests.exceptions.ConnectionError:
150
150
  sleep(1)
151
- r = requests.get(url, headers=header, cookies=config.cookies)
151
+ r = requests.get(url, headers=header, cookies=config.cookies, verify=not config.tlsAllowInvalidCertificates)
152
152
  elif method == 'post':
153
153
  try:
154
- r = requests.post(url, json=data, headers=header, cookies=config.cookies)
154
+ r = requests.post(url, json=data, headers=header, cookies=config.cookies, verify=not config.tlsAllowInvalidCertificates)
155
155
  except requests.exceptions.ConnectionError:
156
156
  sleep(1)
157
- r = requests.post(url, json=data, headers=header, cookies=config.cookies)
157
+ r = requests.post(url, json=data, headers=header, cookies=config.cookies, verify=not config.tlsAllowInvalidCertificates)
158
158
  elif method == 'delete':
159
159
  try:
160
- r = requests.delete(url, headers=header, cookies=config.cookies)
160
+ r = requests.delete(url, headers=header, cookies=config.cookies, verify=not config.tlsAllowInvalidCertificates)
161
161
  except requests.exceptions.ConnectionError:
162
162
  sleep(1)
163
- r = requests.delete(url, headers=header, cookies=config.cookies)
163
+ r = requests.delete(url, headers=header, cookies=config.cookies, verify=not config.tlsAllowInvalidCertificates)
164
164
  else:
165
165
  raise NotImplementedError('method: ' + method + ' not implemented.')
166
166
 
@@ -55,16 +55,17 @@ class ClientConfiguration(object):
55
55
  if 'host' not in self._config['rest'] or not self._config['rest']['host']:
56
56
  raise ValueError('Missing configuration field "host".')
57
57
 
58
- self._validate_host(self._config['rest']['host'])
58
+ self._validate_host()
59
59
 
60
- @staticmethod
61
- def _validate_host(host):
60
+ def _validate_host(self):
62
61
  try:
63
- r = requests.head(host, timeout=2)
62
+ r = requests.head(self.host, timeout=2, verify=not self.tlsAllowInvalidCertificates)
64
63
  if r.status_code == 302:
65
64
  return
65
+ except requests.exceptions.SSLError:
66
+ raise Exception('Invalid SSL certificate from "{}"'.format(self.host))
66
67
  except requests.ConnectionError:
67
- raise Exception('Unreachable host "{}"'.format(host))
68
+ raise Exception('Unreachable host "{}"'.format(self.host))
68
69
 
69
70
  @property
70
71
  def configuration(self):
@@ -77,7 +78,19 @@ class ClientConfiguration(object):
77
78
  @host.setter
78
79
  def host(self, host):
79
80
  self._config['rest']['host'] = host
80
- self._validate_host(host)
81
+ self._validate_host()
82
+
83
+ @property
84
+ def tlsAllowInvalidCertificates(self):
85
+ if ('tlsAllowInvalidCertificates' in self._config['rest'] and
86
+ self._config['rest']['tlsAllowInvalidCertificates'] is not None):
87
+ return self._config['rest']['tlsAllowInvalidCertificates']
88
+ else:
89
+ return False
90
+
91
+ @tlsAllowInvalidCertificates.setter
92
+ def tlsAllowInvalidCertificates(self, tlsAllowInvalidCertificates):
93
+ self._config['rest']['tlsAllowInvalidCertificates'] = tlsAllowInvalidCertificates
81
94
 
82
95
  @property
83
96
  def version(self):
pyxetabase/commons.py CHANGED
@@ -145,22 +145,22 @@ def _fetch(config, sid, category, resource, method, subcategory=None, query_id=N
145
145
  # Getting REST response
146
146
  if method == 'get':
147
147
  try:
148
- r = requests.get(url, headers=header, cookies=config.cookies)
148
+ r = requests.get(url, headers=header, cookies=config.cookies, verify=not config.tlsAllowInvalidCertificates)
149
149
  except requests.exceptions.ConnectionError:
150
150
  sleep(1)
151
- r = requests.get(url, headers=header, cookies=config.cookies)
151
+ r = requests.get(url, headers=header, cookies=config.cookies, verify=not config.tlsAllowInvalidCertificates)
152
152
  elif method == 'post':
153
153
  try:
154
- r = requests.post(url, json=data, headers=header, cookies=config.cookies)
154
+ r = requests.post(url, json=data, headers=header, cookies=config.cookies, verify=not config.tlsAllowInvalidCertificates)
155
155
  except requests.exceptions.ConnectionError:
156
156
  sleep(1)
157
- r = requests.post(url, json=data, headers=header, cookies=config.cookies)
157
+ r = requests.post(url, json=data, headers=header, cookies=config.cookies, verify=not config.tlsAllowInvalidCertificates)
158
158
  elif method == 'delete':
159
159
  try:
160
- r = requests.delete(url, headers=header, cookies=config.cookies)
160
+ r = requests.delete(url, headers=header, cookies=config.cookies, verify=not config.tlsAllowInvalidCertificates)
161
161
  except requests.exceptions.ConnectionError:
162
162
  sleep(1)
163
- r = requests.delete(url, headers=header, cookies=config.cookies)
163
+ r = requests.delete(url, headers=header, cookies=config.cookies, verify=not config.tlsAllowInvalidCertificates)
164
164
  else:
165
165
  raise NotImplementedError('method: ' + method + ' not implemented.')
166
166
 
@@ -55,16 +55,17 @@ class ClientConfiguration(object):
55
55
  if 'host' not in self._config['rest'] or not self._config['rest']['host']:
56
56
  raise ValueError('Missing configuration field "host".')
57
57
 
58
- self._validate_host(self._config['rest']['host'])
58
+ self._validate_host()
59
59
 
60
- @staticmethod
61
- def _validate_host(host):
60
+ def _validate_host(self):
62
61
  try:
63
- r = requests.head(host, timeout=2)
62
+ r = requests.head(self.host, timeout=2, verify=not self.tlsAllowInvalidCertificates)
64
63
  if r.status_code == 302:
65
64
  return
65
+ except requests.exceptions.SSLError:
66
+ raise Exception('Invalid SSL certificate from "{}"'.format(self.host))
66
67
  except requests.ConnectionError:
67
- raise Exception('Unreachable host "{}"'.format(host))
68
+ raise Exception('Unreachable host "{}"'.format(self.host))
68
69
 
69
70
  @property
70
71
  def configuration(self):
@@ -77,7 +78,19 @@ class ClientConfiguration(object):
77
78
  @host.setter
78
79
  def host(self, host):
79
80
  self._config['rest']['host'] = host
80
- self._validate_host(host)
81
+ self._validate_host()
82
+
83
+ @property
84
+ def tlsAllowInvalidCertificates(self):
85
+ if ('tlsAllowInvalidCertificates' in self._config['rest'] and
86
+ self._config['rest']['tlsAllowInvalidCertificates'] is not None):
87
+ return self._config['rest']['tlsAllowInvalidCertificates']
88
+ else:
89
+ return False
90
+
91
+ @tlsAllowInvalidCertificates.setter
92
+ def tlsAllowInvalidCertificates(self, tlsAllowInvalidCertificates):
93
+ self._config['rest']['tlsAllowInvalidCertificates'] = tlsAllowInvalidCertificates
81
94
 
82
95
  @property
83
96
  def version(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyxetabase
3
- Version: 3.1.0.dev5
3
+ Version: 3.1.0.dev7
4
4
  Summary: A REST client for OpenCGA enterprise REST web services
5
5
  Author: Daniel Perez-Gil
6
6
  Author-email: daniel.perez@zettagenomics.com
@@ -1,8 +1,8 @@
1
1
  pyopencga/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- pyopencga/commons.py,sha256=BLFolLT0UGkb3866wKGPlLh4pCX8Ym-JCUBMOcoeBHM,14025
2
+ pyopencga/commons.py,sha256=asnM3N7Q6JdgD6hXWmlX875HJizTLAODqs0dl3UYH-E,14307
3
3
  pyopencga/exceptions.py,sha256=GmtDcurD3d_fzaa8AEntF4-sZR4Elgg4Iz3z-UUqjYU,274
4
4
  pyopencga/opencga_client.py,sha256=gM9UzbjXwHKYRbsz3qmhS8xHuIlr13sn-VEzx6cscxk,14858
5
- pyopencga/opencga_config.py,sha256=CS_IkQMS1zsO3XXa8XgJOaNtMt9EnBeFnsN9PW6hYL8,5031
5
+ pyopencga/opencga_config.py,sha256=TCzg_9k7tl1M2OqKIrpP8jEdKodzrTh1iN-rgSWEl1M,5687
6
6
  pyopencga/rest_response.py,sha256=Gx7utYTsXV-aciFZV4f7M2eNDQg5IlphGK_T8q_PhHE,8634
7
7
  pyopencga/retry.py,sha256=_X02bDcJmr9cWH4Bt0YfUPkYborpuStmw5WDDKczwHM,2296
8
8
  pyopencga/rest_clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -27,10 +27,10 @@ pyopencga/rest_clients/variant_client.py,sha256=qao-KWLjp04mDN3q7tQYsJzsQpxMaMvM
27
27
  pyopencga/rest_clients/variant_operation_client.py,sha256=HYBQOSwXKdFTDbaxZfA4hUa66yKCfwCT7r272hLdQLc,36910
28
28
  pyopencga/rest_clients/workflow_client.py,sha256=TN_x3CpC-GIojfsJNZmwPMCeXMUSPxKIas2PnNN18H4,12481
29
29
  pyxetabase/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
- pyxetabase/commons.py,sha256=uQOTM-5WNRSB-FYST5jRArQdCaaFXvfrVQ43nQ5w8oQ,14026
30
+ pyxetabase/commons.py,sha256=Okt5DgvSpZW9PUsxoLNpROb0BDrdr_zhgry4X3dQpfk,14308
31
31
  pyxetabase/exceptions.py,sha256=GmtDcurD3d_fzaa8AEntF4-sZR4Elgg4Iz3z-UUqjYU,274
32
32
  pyxetabase/opencga_client.py,sha256=V-M9i28z3A-Vgw5BnG_Ddm0MUdjQ0_XG38gohGtzavI,15386
33
- pyxetabase/opencga_config.py,sha256=CS_IkQMS1zsO3XXa8XgJOaNtMt9EnBeFnsN9PW6hYL8,5031
33
+ pyxetabase/opencga_config.py,sha256=TCzg_9k7tl1M2OqKIrpP8jEdKodzrTh1iN-rgSWEl1M,5687
34
34
  pyxetabase/rest_response.py,sha256=TgwTI2LZFF_jV9-HSawGkF_qZ88n-dxEtIKiFcfPyDk,8635
35
35
  pyxetabase/retry.py,sha256=LjViQOaa_GkpDFkcRq9jIS183mE9t4Rq0uls9PV_mfI,2297
36
36
  pyxetabase/rest_clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -56,8 +56,8 @@ pyxetabase/rest_clients/user_client.py,sha256=frA7-rMii-yoRyca_Orkj1T80OeEe-zCdW
56
56
  pyxetabase/rest_clients/variant_client.py,sha256=mmBuVE0JBThJr5zsLGci5nykNcCKyfZXRKl-h3HT9PA,75436
57
57
  pyxetabase/rest_clients/variant_operation_client.py,sha256=oN7AEQzAkrmLQLbw86CODCEnR5xM6UkqrdN-9WPO_rM,36911
58
58
  pyxetabase/rest_clients/workflow_client.py,sha256=QYnyI17aNCjq-uXlguaSj78F0xupeWwmf8uYK1Y5tf4,12482
59
- pyxetabase-3.1.0.dev5.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
60
- pyxetabase-3.1.0.dev5.dist-info/METADATA,sha256=zDC9nYhvppdSPOTGRxBJpzag77ep6OClfuziGessti0,5539
61
- pyxetabase-3.1.0.dev5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
62
- pyxetabase-3.1.0.dev5.dist-info/top_level.txt,sha256=0m5pDpBX-lM8QpPl7bTpTQAm4kgu2-nr-pcaEu4Tn_8,11
63
- pyxetabase-3.1.0.dev5.dist-info/RECORD,,
59
+ pyxetabase-3.1.0.dev7.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
60
+ pyxetabase-3.1.0.dev7.dist-info/METADATA,sha256=XsYVxKCQ6AOMK7MhXdfc7rQMpSLALOjzrvtNqEuzWlI,5539
61
+ pyxetabase-3.1.0.dev7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
62
+ pyxetabase-3.1.0.dev7.dist-info/top_level.txt,sha256=0m5pDpBX-lM8QpPl7bTpTQAm4kgu2-nr-pcaEu4Tn_8,11
63
+ pyxetabase-3.1.0.dev7.dist-info/RECORD,,