Environment variables¶
This notebook reads its settings from environment variables. Set them before starting Jupyter:
S3_BUCKET: name of an S3 bucket you can access
The cell downloads ganymede-demo/example.zip from that bucket; upload any zip archive there first.
Example 1¶
Download a file from a remote path on s3 to local filesystem
In [ ]:
Copied!
import os
from fsspec import filesystem
from pathlib import Path
tmp = "/tmp/ganymede_demo"
Path(tmp).mkdir(parents=True, exist_ok=True)
s3 = filesystem("s3")
local_zip_fp = f"{tmp}/example.zip"
s3.get(rpath=f"s3://{os.environ['S3_BUCKET']}/ganymede-demo/example.zip", lpath=local_zip_fp)
import os
from fsspec import filesystem
from pathlib import Path
tmp = "/tmp/ganymede_demo"
Path(tmp).mkdir(parents=True, exist_ok=True)
s3 = filesystem("s3")
local_zip_fp = f"{tmp}/example.zip"
s3.get(rpath=f"s3://{os.environ['S3_BUCKET']}/ganymede-demo/example.zip", lpath=local_zip_fp)