Skip to main content

Egnyte SDK

This is the official Python client library for Egnyte’s Public APIs. For overview of the HTTP API, go to https://developers.egnyte.com

Getting an API key

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.

Examples

  • Include this library

  • Generate an access token

  • Create a client object

client = egnyte.EgnyteClient({"domain": "apidemo.egnyte.com",
    "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")
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'!")
  • Get a list of files in a subfolders

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

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

file_obj.delete()
  • 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 = api.search.files('"some text" OR "other text"', folder='/Shared', modified_after=datetime.date(2015, 1, 15))
  • Get and process events from server

events = api.events.filter(folder='/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
    do_something(event)
    if condition(event):
        break

Full documentation

The docs subdirectory contains just the source for the documentation. You can read the documentation at http://egnyte.github.io/python-egnyte-docs/

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

Dependencies

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 setup.py:

python setup.py test

or

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. example.egnyte.com",
    "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 https://developers.egnyte.com/docs/read/Public_API_Authentication#Internal-Applications for information about how to generate access token.

Helping with development

Please report any problems you find to api-support@egnyte.com or pint@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.

Metadata

Release files for egnyte 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for egnyte 0.5.3
File Size Uploaded Provenance Actions
egnyte-0.5.3.tar.gz 32.7 kB Without provenance Details for egnyte-0.5.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for egnyte 0.5.3
File Interpreter ABI Platform Actions
egnyte-0.5.3-py2.py3-none-any.whl Python 3, Python 2 none any Details for egnyte-0.5.3-py2.py3-none-any.whl
egnyte-0.5.3-py2.7.egg Legacy Egg format - - Details for egnyte-0.5.3-py2.7.egg

Total release size: 164.8 kB

Release files / egnyte-0.5.3.tar.gz

Download URL egnyte-0.5.3.tar.gz
Size 32.7 kB
Tags Source
SHA-256 checksum
How to use checksums
accbebdb71d1fb6416f1eccd9d8a678570120d28dfc7888fe46de7bf066a36e2
BLAKE2b-256 checksum
How to use checksums
72f2fc190d97d11c277ecc0ee01c52800c548e6754404f122146f931fe3583da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / egnyte-0.5.3-py2.py3-none-any.whl

Download URL egnyte-0.5.3-py2.py3-none-any.whl
Size 41.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
4a8082c9c4fc566f9cf8c97cfaab2c200c2c4d640986c30b7070148655b3a2c3
BLAKE2b-256 checksum
How to use checksums
5005036f296d4fc45675f3cbaa6f4b72b58648cffbb31f542138e3a0b464330d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / egnyte-0.5.3-py2.7.egg

Download URL egnyte-0.5.3-py2.7.egg
Size 91.1 kB
Tags Egg
SHA-256 checksum
How to use checksums
9b25e889fff80ca442e338a82f01ad62e0d552d89299b9a0a8e477e1c8506892
BLAKE2b-256 checksum
How to use checksums
038ff617f1f038f20f1dac764bd7fb9c3dacedd437e9c3efb3a2438127f22379
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for egnyte 0.5.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page