drb-driver-http 1.3.4__tar.gz → 1.3.6__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 (31) hide show
  1. {drb_driver_http-1.3.4/drb_driver_http.egg-info → drb_driver_http-1.3.6}/PKG-INFO +1 -1
  2. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb/drivers/http/_version.py +3 -3
  3. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb/drivers/http/http.py +15 -9
  4. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6/drb_driver_http.egg-info}/PKG-INFO +1 -1
  5. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/tests/test_drb_impl_http.py +10 -2
  6. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/LICENCE.txt +0 -0
  7. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/README.md +0 -0
  8. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb/drivers/http/__init__.py +0 -0
  9. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb/drivers/http/oauth2/HTTPOAuth2.py +0 -0
  10. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb/drivers/http/oauth2/__init__.py +0 -0
  11. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb/drivers/http/oauth2/oauth2.py +0 -0
  12. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb/exceptions/http.py +0 -0
  13. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb/topics/http/__init__.py +0 -0
  14. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb/topics/http/cortex.yml +0 -0
  15. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb_driver_http.egg-info/SOURCES.txt +0 -0
  16. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb_driver_http.egg-info/dependency_links.txt +0 -0
  17. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb_driver_http.egg-info/entry_points.txt +0 -0
  18. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb_driver_http.egg-info/not-zip-safe +0 -0
  19. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb_driver_http.egg-info/requires.txt +0 -0
  20. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/drb_driver_http.egg-info/top_level.txt +0 -0
  21. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/pyproject.toml +0 -0
  22. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/requirements.txt +0 -0
  23. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/setup.cfg +0 -0
  24. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/setup.py +0 -0
  25. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/tests/test_drb_http_basic_auth.py +0 -0
  26. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/tests/test_drb_http_bearer.py +0 -0
  27. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/tests/test_drb_http_factory.py +0 -0
  28. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/tests/test_drb_http_keyring.py +0 -0
  29. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/tests/test_drb_http_signature.py +0 -0
  30. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/tests/test_drb_https_signature.py +0 -0
  31. {drb_driver_http-1.3.4 → drb_driver_http-1.3.6}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: drb-driver-http
3
- Version: 1.3.4
3
+ Version: 1.3.6
4
4
  Summary: DRB Http driver
5
5
  Author: GAEL Systems
6
6
  Author-email: drb-python@gael.fr
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2024-07-18T15:06:45+0200",
11
+ "date": "2025-03-25T14:38:50+0100",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "7040fb7f6f65fd452bcae5937f5be5b47cf68b24",
15
- "version": "1.3.4"
14
+ "full-revisionid": "7db4ae8d4ff1a5d43115b127f9b0b2801a30a566",
15
+ "version": "1.3.6"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import io
4
4
  import re
5
+ import sys
5
6
 
6
7
  import keyring
7
8
  from deprecated import deprecated
@@ -39,7 +40,7 @@ class EmptyAuth(AuthBase):
39
40
  retry=retry_if_exception_type(DrbHttpNodeException))
40
41
  def get(path: str, auth: AuthBase, redirect, headers, params: Dict[str, Any]):
41
42
  return requests.get(path, stream=True, auth=auth, allow_redirects=redirect,
42
- headers=headers, **params)
43
+ headers=headers, params=params)
43
44
 
44
45
 
45
46
  @retry(stop=stop_after_attempt(5),
@@ -284,17 +285,22 @@ class DrbHttpNode(AbstractNode):
284
285
  for x in res.headers:
285
286
  self.__imatmul__((x, res.headers[x]))
286
287
 
287
- @property
288
- def name(self) -> str:
289
- key = ('Content-Disposition', None)
290
- if key in self._attrs.keys():
291
- p = re.compile('filename ?= ?"(.*)"')
292
- res = p.search(self.get_attribute(key[0]))
293
- if res is not None:
294
- return res.group(1)
288
+ def __get_name_from_url(self):
295
289
  parsed_uri = urlparse(self._path)
296
290
  return str(parsed_uri.path).split('/')[-1]
297
291
 
292
+ @property
293
+ def name(self) -> str:
294
+ self.__init_header()
295
+ try:
296
+ disposition = self.__matmul__('content-disposition')
297
+ r = re.search(r'filename ?= ?((["\'])?(.*)(["\'])?)', disposition)
298
+ if r:
299
+ return r.group(1).replace("'", "").replace('"', "")
300
+ return self.__get_name_from_url()
301
+ except DrbException:
302
+ return self.__get_name_from_url()
303
+
298
304
  @property
299
305
  @deprecated(version='1.2.0',
300
306
  reason='Only bracket browse should be use')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: drb-driver-http
3
- Version: 1.3.4
3
+ Version: 1.3.6
4
4
  Summary: DRB Http driver
5
5
  Author: GAEL Systems
6
6
  Author-email: drb-python@gael.fr
@@ -118,8 +118,16 @@ class TestDrbHttp(unittest.TestCase):
118
118
  DrbHttpNode(self.url_ok).attributes[key]
119
119
 
120
120
  def test_name(self):
121
- node = DrbHttpNode(self.url_ok)
122
- self.assertEqual('test.txt', node.name)
121
+ expected = "data.json"
122
+ with patch('requests.head') as mock_head:
123
+ mock_head.return_value.status_code = 200
124
+ mock_head.return_value.headers = {
125
+ 'Content-Type': 'application/json',
126
+ 'Content-Length': 20,
127
+ 'Content-Disposition': f'attachment; filename="{expected}"',
128
+ }
129
+ node = DrbHttpNode('http://something.net/foobar')
130
+ self.assertEqual(expected, node.name)
123
131
 
124
132
  def test_namespace_uri(self):
125
133
  node = DrbHttpNode(self.url_ok)