All Projects → egnyte → python-egnyte

egnyte / python-egnyte

Licence: MIT License
Python client for the Egnyte Public API.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to python-egnyte

dns
dns is a simple CLI tool for DNS-LG API
Stars: ✭ 28 (+75%)
Mutual labels:  api-client
laravel-quickbooks-client
SPINEN's Laravel Client for QuickBooks.
Stars: ✭ 25 (+56.25%)
Mutual labels:  api-client
postmates-api
PHP API Client for Posmates
Stars: ✭ 16 (+0%)
Mutual labels:  api-client
keen-analysis.js
A light JavaScript client for Keen
Stars: ✭ 40 (+150%)
Mutual labels:  api-client
messaging-apis
Messaging APIs for multi-platform
Stars: ✭ 1,759 (+10893.75%)
Mutual labels:  api-client
j2ssh-maverick
The open source branch of our legacy API providing a robust, mission critical SSH component to the community.
Stars: ✭ 57 (+256.25%)
Mutual labels:  api-client
CompaniesHouse.NET
A simple .NET client wrapper for CompaniesHouse API
Stars: ✭ 28 (+75%)
Mutual labels:  api-client
enasearch
A Python library for interacting with ENA's API
Stars: ✭ 17 (+6.25%)
Mutual labels:  api-client
revolut-php
💳 PHP Bindings for the Revolut Business API
Stars: ✭ 37 (+131.25%)
Mutual labels:  api-client
eoLinker
在线 API 研发管理测试工具,最后能用的开源修复版本(4.0.1本地测试插件兼容3.5与4.0版本)。
Stars: ✭ 62 (+287.5%)
Mutual labels:  api-client
pychannels
Python library for querying and controlling the Channels app.
Stars: ✭ 15 (-6.25%)
Mutual labels:  api-client
hcloud-rust
Unofficial Rust crate for accessing the Hetzner Cloud API
Stars: ✭ 22 (+37.5%)
Mutual labels:  api-client
pastebin-csharp
API client for Pastebin in C#
Stars: ✭ 25 (+56.25%)
Mutual labels:  api-client
tweetsOLAPing
implementing an end-to-end tweets ETL/Analysis pipeline.
Stars: ✭ 24 (+50%)
Mutual labels:  api-client
dataiku-api-client-python
Python client for the DSS public API
Stars: ✭ 32 (+100%)
Mutual labels:  api-client
downcloud
Download your own Soundcloud tracks (uncompressed)
Stars: ✭ 22 (+37.5%)
Mutual labels:  api-client
Bittrex.Api.Client
A C# http client wrapper for the Bittrex cryptocurrency trading platform api
Stars: ✭ 14 (-12.5%)
Mutual labels:  api-client
jarling
A Java Library for the Starling Bank API
Stars: ✭ 14 (-12.5%)
Mutual labels:  api-client
square-java-sdk
Java client library for the Square API
Stars: ✭ 39 (+143.75%)
Mutual labels:  api-client
jobs-stackoverflow
Making it easy to integrate with the Stack Overflow job board API
Stars: ✭ 17 (+6.25%)
Mutual labels:  api-client

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 continuously, 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/

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:

egnyte -h

Create configuration

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

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

Dependencies

This library depends on:

  • Python 3.6-3.9
  • requests 2.13.0 or later

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:

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 [email protected] or [email protected]

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].