This is the official Python client library for Egnyte’s Public APIs. For overview of the HTTP API, go to https://developers.egnyte.com
Register on https://developers.egnyte.com/member/register to get API key for your Egnyte account. This key is required to generate an Egnyte OAuth token.
client = egnyte.EgnyteClient({"domain": "apidemo.egnyte.com",
"access_token": "68zc95e3xv954u6k3hbnma3q"})
folder = client.folder("/Shared/new").create(ignore_if_exists=True)
client.folder("/Shared/time to say goodbye").delete()
folder = client.folder("/Shared/foo that need to be bar")
folder.list()
for file_obj in folder.files:
with file_obj.download() as download:
data = download.read()
# replace file contents
file_obj.upload(data.replace(b"foo", b"bar"))
file_obj.add_note("all occurrences of 'foo' replaced by 'bar'!")
folder = client.folder("/Shared")
folder.list()
for folder_obj in folder.folders:
do_something(folder_obj)
file_obj = client.file("/Private/smeagol/my precious")
with open("local path", "rb") as fp:
file_obj.upload(fp)
file_obj.delete()
client.bulk_download(['/Shared/a dir', '/Shared/another dir'],
'/home/smeagol/', overwrite=True)
api.bulk_upload(['/tmp/some directory', '/tmp/some file'], '/Shared/Marketing')
The docs subdirectory contains just the source for the documentation. You can read the documentation at http://egnyte.github.io/python-egnyte-docs/
If you’re using implicit flow, you’ll need to provide access token directly. If you’re using API token with resource flow, you can generate API access token using command line options. See the full documentation or install, then use:
python -m egnyte -h
This library depends on:
Each client object should be used from one thread at a time. This library does no locking of it’s own - it is responsibility of the caller to do so if necessary.
Tests can be run with nose or trial directly on the egnyte package, or from setup.py:
python setup.py test
or
python setup.py nosetests
Integration tests will be skipped unless you create ~/.egnyte/test_config.json You can create this file manually or with following command:
python -m egnyte -c test_config.json config create -k -d -l [-p ]
First, report any problems you find to https://developers.egnyte.com/forum/ or api-support@egnyte.com
If you’d like to fix something yourself, please fork this repository, commit the fixes and updates to tests, then set up a pull request with information what you’re fixing.
Please remember to assign copyright of your fixes to Egnyte or make them public domain so we can legally merge them.