GET a file from the server and save it to the given path, which includes the filename.
(
self,
url: str,
path: str,
parameters: dict[str, Any] | None = None,
headers: dict[str, str] | None = None,
cnx: HTTPRequestsConnectionClass | HTTPSRequestsConnectionClass | None = None,
chunk_size: int | None | None = 1,
)
| 1001 | return {"data": data} |
| 1002 | |
| 1003 | def getFile( |
| 1004 | self, |
| 1005 | url: str, |
| 1006 | path: str, |
| 1007 | parameters: dict[str, Any] | None = None, |
| 1008 | headers: dict[str, str] | None = None, |
| 1009 | cnx: HTTPRequestsConnectionClass | HTTPSRequestsConnectionClass | None = None, |
| 1010 | chunk_size: int | None | None = 1, |
| 1011 | ) -> None: |
| 1012 | """ |
| 1013 | GET a file from the server and save it to the given path, which includes the filename. |
| 1014 | """ |
| 1015 | _, _, stream_chunk_iterator = self.getStream(url, parameters, headers, cnx, chunk_size=chunk_size) |
| 1016 | with open(path, "wb") as f: |
| 1017 | for chunk in stream_chunk_iterator: |
| 1018 | if chunk: |
| 1019 | f.write(chunk) |
| 1020 | |
| 1021 | def getStream( |
| 1022 | self, |
no test coverage detected