Skip to main content

Egnyte Public API SDK

Project description

Egnyte SDK

This is the official Python client library for Egnyte’s Public APIs. For overview of the HTTP API, go to

Getting an API key

Register on to get API key for your Egnyte account. This key is required to generate an Egnyte OAuth token.


  • Include this library

  • Generate an access token

  • Create a client object

client = egnyte.EgnyteClient({"domain": "",
    "access_token": "68zc95e3xv954u6k3hbnma3q"})
  • Create a folder

folder = client.folder("/Shared/new").create(ignore_if_exists=True)
  • Delete a folder

client.folder("/Shared/time to say goodbye").delete()
  • Get a list of files in a folder, download a file, replace it’s contents, add a note

folder = client.folder("/Shared/foo that need to be bar")
for file_obj in folder.files:
    with as download:
        data =
    # replace file contents
    file_obj.upload(data.replace(b"foo", b"bar"))
    file_obj.add_note("all occurrences of 'foo' replaced by 'bar'!")
  • Get a list of files in a subfolders

folder = client.folder("/Shared")
for folder_obj in folder.folders:
  • Upload a new file from local file

file_obj = client.file("/Private/smeagol/my precious")
with open("local path", "rb") as fp:
  • Delete a file

  • Do a recursive download

client.bulk_download(['/Shared/a dir', '/Shared/another dir'],
    '/home/smeagol/', overwrite=True)
  • Do a recursive upload

client.bulk_upload(['/tmp/some directory', '/tmp/some file'], '/Shared/Marketing')
  • Search for files

import datetime
results ='"some text" OR "other text"', folder='/Shared',, 1, 15))
  • Get and process events from server

events ='/Shared', suppress='user')
old_events = events.list(events.latest_event_id - 10, count = 10) # get events in batches
future_events = iter(events)
for event in future_events: # polls server continously, iterator over single events, iterator will never end
    if condition(event):

Full documentation

The docs subdirectory contains just the source for the documentation. You can read the documentation at

Command line

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

Create configuration

Configuration file will be created in ~/.egnyte/config.json

python -m egnyte config create -d DOMAIN [-l LOGIN] [-p PASSWORD] -k API_KEY [-t ACCESS_TOKEN] [-T TIMEOUT]

Set request timeout

python -m egnyte config update --timeout TIMEOUT_INTEGER


This library depends on:

  • requests 2.13.0 or later - for HTTPS calls

  • six 1.10.0 or later - for Python 2 and 3 compatibility using same source

Thread safety

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.

Running tests

Tests can be run with nose or trial directly on the egnyte package, or from

python test


python -m unittest discover

In order to run tests, you need to create test configuration file: ~/.egnyte/test_config.json

    "access_token": "access token you received after passing the auth flow",
    "api_key": "key you received after registering your developer account",
    "domain": "your Egnyte domain, e.g.",
    "login": "username of Egnyte admin user",
    "password": "password of the same Egnyte admin user"

You can create this file manually or with following command:

python -m egnyte -c test\_config.json config create -k <API_Key> -d <domain> -l <username> -p <password> -t <access_token>

Tests will be run against your domain on behalf on admin user.

Please refer to for information about how to generate access token.

Helping with development

Please report any problems you find to or

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.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

egnyte-0.5.3.tar.gz (32.7 kB view hashes)

Uploaded Source

Built Distributions

egnyte-0.5.3-py2.py3-none-any.whl (41.0 kB view hashes)

Uploaded Python 2 Python 3

egnyte-0.5.3-py2.7.egg (91.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page