azfiles
Allow you interact with Azure fileshares without installing az-cli.
Main intention to allow move files but keep it minimal. Project has 2 external
dependencies: requests and python-dateutil and pytest -cov shows 323
lines of production code at this time.
Get it:
pip install azfiles
Get help:
$ azfiles
azfiles - interact with Azure file shares
Available mounts:
['mnt01']
USAGES:
azfiles <remote_path> add_mount <storage_account> <share> <sas_token>
azfiles <remote_path> delete
azfiles <remote_path> delete_mount
azfiles <remote_path> download <local_path>
azfiles <remote_path> list
azfiles <remote_path> props
azfiles <remote_path> upload <local_str>
$
How to
Generate SAS token for particular share and register it with azfiles as mount mnt01 :
end=`date -v +1y '+%Y-%m-%dT%H:%MZ'` #end access in one year
SAS=`az storage share generate-sas -n $SHARE --account-name $ACCT --https-only --expiry $end --permissions dlrw -o tsv`
azfiles mnt01: add_mount $ACCT $SHARE "$SAS"
After that you are ready to interact with storage. Upload file at any <remote_path>. Slash at the end of <remote_path> is important to tell save this file in remote directory and keep it's name.
$ azfiles mnt01:/logs/ upload ~/backup.log
$ azfiles mnt01:/ upload hello.txt
$
Diretories will be created along. You can change name of the file. Notice no slash in next example:
$ azfiles mnt01:/backups/logs/20210730.log upload ~/backup.log
List remote directory content:
$ azfiles mnt01:/logs/ list
mnt01:/logs
name,type,size,creation_time,last_access_time,last_write_time,etag
backup.log,File,38070517,2021-07-30T18:13:20+00:00,2021-07-30T18:13:20+00:00,2021-07-30T18:13:20+00:00,"0x8D95385C4B8D2D8"
$ azfiles mnt01:/ list
mnt01:/
name,type,size,creation_time,last_access_time,last_write_time,etag
abc,Directory,,2021-07-30T06:29:13+00:00,2021-07-30T06:29:13+00:00,2021-07-30T06:29:13+00:00,"0x8D9532359534095"
backups,Directory,,2021-07-30T18:16:32+00:00,2021-07-30T18:16:32+00:00,2021-07-30T18:16:32+00:00,"0x8D9538628A3B80C"
hello.txt,File,13,2021-07-30T18:26:54+00:00,2021-07-30T18:26:54+00:00,2021-07-30T18:26:54+00:00,"0x8D953879BD09E17"
logs,Directory,,2021-07-30T18:13:20+00:00,2021-07-30T18:13:20+00:00,2021-07-30T18:13:20+00:00,"0x8D95385B635435D"
You can check on single file too:
$ azfiles mnt01:/backups/logs/20210730.log props
20210730.log,File,38070517,2021-07-30T18:16:32+00:00,,2021-07-30T18:16:32+00:00,"0x8D9538638AFD991"
You and of course you can get your files back. You dont have to add slash to <local_path> if this directory already exists:
$ azfiles mnt01:/backups/logs/20210730.log download .
Release files for azfiles 2021.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| azfiles-2021.8.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| azfiles-2021.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.3 kB
Release files / azfiles-2021.8.tar.gz
| Download URL | azfiles-2021.8.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e28a91eea8d64a8206e776bc1511f7269d4f6bf176ee2478c43269f4278bd34
|
|
BLAKE2b-256 checksum How to use checksums |
d1aad711da01252bc332c7cff424340a1f381219ae76cea0f89aa03703549ca1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.6.13
|
Release files / azfiles-2021.8-py3-none-any.whl
| Download URL | azfiles-2021.8-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
729de504b81658ea588f9599877c740dd6b22d2f51f9ea7bededf60930493b68
|
|
BLAKE2b-256 checksum How to use checksums |
9bb2eadc3e4f28fdcf23cd16a1f979e907efb59480e9ae70f43bee714c8319df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.6.13
|