cloud-files 4.24.2__py3-none-any.whl → 4.25.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloud-files
3
- Version: 4.24.2
3
+ Version: 4.25.0
4
4
  Summary: Fast access to cloud storage and local FS.
5
5
  Home-page: https://github.com/seung-lab/cloud-files/
6
6
  Author: William Silversmith
@@ -5,7 +5,7 @@ cloudfiles/compression.py,sha256=pqYdpu5vfFv-094BpfZ2pgRjVu7ESM9pAZC09P6E8bY,615
5
5
  cloudfiles/connectionpools.py,sha256=aL8RiSjRepECfgAFmJcz80aJFKbou7hsbuEgugDKwB8,4814
6
6
  cloudfiles/exceptions.py,sha256=H2IcMlZoy2Bsn-6wCPwyLDjg66LZCyxtcf3s_p21FDw,770
7
7
  cloudfiles/gcs.py,sha256=_njJ7TpqwrHCjPHRGkBN5alCrCWKM2m9qdy5DhxMZ7U,3718
8
- cloudfiles/interfaces.py,sha256=JiuCOEeFMsA7c-CIdXoxpv49bV9DFjol_8nLHKAfga0,34646
8
+ cloudfiles/interfaces.py,sha256=Qqhjv2GIVw3ibaTgPpiGK97i7aBDgU9O0bBuOiLI2KM,36117
9
9
  cloudfiles/lib.py,sha256=fEqL5APu_WQhl2yxqQbwE7msHdu7U8pstAJw6LgoKO0,5142
10
10
  cloudfiles/paths.py,sha256=tqR9XnRdAKopTJqSM6V5xrMo1xfmBdl9b5DpBLZnoB0,9998
11
11
  cloudfiles/resumable_tools.py,sha256=pK-VcoPjQ2BjGjvlvH4dDCBf6lNsqHG-weiBgxVFbzA,5838
@@ -16,11 +16,11 @@ cloudfiles/typing.py,sha256=f3ZYkNfN9poxhGu5j-P0KCxjCCqSn9HAg5KiIPkjnCg,416
16
16
  cloudfiles_cli/LICENSE,sha256=Jna4xYE8CCQmaxjr5Fs-wmUBnIQJ1DGcNn9MMjbkprk,1538
17
17
  cloudfiles_cli/__init__.py,sha256=Wftt3R3F21QsHtWqx49ODuqT9zcSr0em7wk48kcH0WM,29
18
18
  cloudfiles_cli/cloudfiles_cli.py,sha256=eETIOK4QyztQcpA4ZRny21SobLtcrPDlzZ_JaKBmmmA,28449
19
- cloud_files-4.24.2.dist-info/AUTHORS,sha256=7E2vC894bbLPO_kvUuEB2LFZZbIxZn23HabxH7x0Hgo,266
20
- cloud_files-4.24.2.dist-info/LICENSE,sha256=Jna4xYE8CCQmaxjr5Fs-wmUBnIQJ1DGcNn9MMjbkprk,1538
21
- cloud_files-4.24.2.dist-info/METADATA,sha256=q4prPh_K-kLm9QJ5etEy9EL4kSKCmkmvSfe1Rn3nF_o,26804
22
- cloud_files-4.24.2.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
23
- cloud_files-4.24.2.dist-info/entry_points.txt,sha256=xlirb1FVhn1mbcv4IoyMEGumDqKOA4VMVd3drsRQxIg,51
24
- cloud_files-4.24.2.dist-info/pbr.json,sha256=TurbdioiITNfj7yFs23q9tPXWIzoIoirwMVmpG2oknM,46
25
- cloud_files-4.24.2.dist-info/top_level.txt,sha256=xPyrST3okJbsmdCF5IC2gYAVxg_aD5AYVTnNo8UuoZU,26
26
- cloud_files-4.24.2.dist-info/RECORD,,
19
+ cloud_files-4.25.0.dist-info/AUTHORS,sha256=7E2vC894bbLPO_kvUuEB2LFZZbIxZn23HabxH7x0Hgo,266
20
+ cloud_files-4.25.0.dist-info/LICENSE,sha256=Jna4xYE8CCQmaxjr5Fs-wmUBnIQJ1DGcNn9MMjbkprk,1538
21
+ cloud_files-4.25.0.dist-info/METADATA,sha256=wXrUnPFfMt3vMXfcxvqMpOB6fVsHRV1cEhDgFr4LdqQ,26804
22
+ cloud_files-4.25.0.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
23
+ cloud_files-4.25.0.dist-info/entry_points.txt,sha256=xlirb1FVhn1mbcv4IoyMEGumDqKOA4VMVd3drsRQxIg,51
24
+ cloud_files-4.25.0.dist-info/pbr.json,sha256=v8YZnfyUynJ66Bxxf0b3fjSVxyAmHqmTI4XJ4BP25pg,46
25
+ cloud_files-4.25.0.dist-info/top_level.txt,sha256=xPyrST3okJbsmdCF5IC2gYAVxg_aD5AYVTnNo8UuoZU,26
26
+ cloud_files-4.25.0.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+ {"git_version": "7dcc163", "is_release": true}
cloudfiles/interfaces.py CHANGED
@@ -714,6 +714,8 @@ class GoogleCloudStorageInterface(StorageInterface):
714
714
  pool.release_connection(self._bucket)
715
715
 
716
716
  class HttpInterface(StorageInterface):
717
+ adaptor = requests.adapters.HTTPAdapter()
718
+
717
719
  def __init__(self, path, secrets=None, request_payer=None, **kwargs):
718
720
  super(StorageInterface, self).__init__()
719
721
  self._path = path
@@ -724,6 +726,8 @@ class HttpInterface(StorageInterface):
724
726
  secrets = http_credentials()
725
727
 
726
728
  self.session = requests.Session()
729
+ self.session.mount('http://', self.adaptor)
730
+ self.session.mount('https://', self.adaptor)
727
731
  if secrets and 'user' in secrets and 'password' in secrets:
728
732
  self.session.auth = (secrets['user'], secrets['password'])
729
733
 
@@ -822,9 +826,58 @@ class HttpInterface(StorageInterface):
822
826
  if token is None:
823
827
  break
824
828
 
829
+ def _list_files_apache(self, prefix, flat):
830
+ import lxml.html
831
+
832
+ baseurl = posixpath.join(self._path.host, self._path.path)
833
+
834
+ directories = ['']
835
+
836
+ while directories:
837
+ directory = directories.pop()
838
+ url = posixpath.join(baseurl, directory)
839
+
840
+ resp = requests.get(url)
841
+ resp.raise_for_status()
842
+
843
+ if 'text/html' not in resp.headers["Content-Type"]:
844
+ raise ValueError("Unable to parse non-HTML output from Apache servers.")
845
+
846
+ entities = lxml.html.document_fromstring(resp.content)
847
+ resp.close()
848
+
849
+ h1 = entities.xpath("body/h1")[0].text_content()
850
+ if "Index of" not in h1:
851
+ raise ValueError("Unable to parse non-index page.")
852
+
853
+ for li in entities.xpath("body/ul/li"):
854
+ txt = li.text_content().strip()
855
+ if txt == "Parent Directory":
856
+ continue
857
+
858
+ txt = posixpath.join(directory, txt)
859
+ if prefix and not txt.startswith(prefix):
860
+ continue
861
+
862
+ if txt[-1] == '/':
863
+ directories.append(txt)
864
+ continue
865
+
866
+ yield txt
867
+
868
+ if flat:
869
+ break
870
+
825
871
  def list_files(self, prefix, flat=False):
826
872
  if self._path.host == "https://storage.googleapis.com":
827
873
  yield from self._list_files_google(prefix, flat)
874
+
875
+ url = posixpath.join(self._path.host, self._path.path, prefix)
876
+ resp = requests.head(url)
877
+
878
+ server = resp.headers.get("Server", "").lower()
879
+ if 'apache' in server:
880
+ yield from self._list_files_apache(prefix, flat)
828
881
  else:
829
882
  raise NotImplementedError()
830
883
 
@@ -1 +0,0 @@
1
- {"git_version": "84826ee", "is_release": true}