Skip to main content

Python client library for ownCloud

Project description

https://travis-ci.org/owncloud/pyocclient.svg?branch=master

This pure python library makes it possible to connect to an ownCloud instance and perform file, share and attribute operations.

Please note that this is not a sync client implementation but a library that provides functions to abstract away HTTP calls for various ownCloud APIs.

See the ownCloud homepage for more information about ownCloud.

Features

Supports connecting to ownCloud 8, 9 and newer.

General information

  • retrieve information about ownCloud instance (e.g. version, host, URL, etc.)

Accessing files

  • basic file operations like getting a directory listing, file upload/download, directory creation, etc

  • read/write file contents from strings

  • upload with chunking and mtime keeping

  • upload whole directories

  • directory download as zip

Sharing (OCS Share API)

  • share a file/directory via public link

  • share a file/directory with another user or group

  • unshare a file/directory

  • check if a file/directory is already shared

  • get information about a shared resource

  • update properties of a known share

Apps (OCS Provisioning API)

  • enable/disable apps

  • retrieve list of enabled apps

Users (OCS Provisioning API)

  • create/delete users

  • create/delete groups

  • add/remove user from groups

App data

  • store app data as key/values using the privatedata OCS API

Requirements

  • Python >= 2.7 (no support for Python 3 yet)

  • requests module (for making HTTP requests)

Installation

Automatic installation with pip:

$ pip install pyocclient

Manual installation of development version with git:

$ pip install requests
$ git clone https://github.com/owncloud/pyocclient.git
$ cd pyocclient
$ python setup.py install

Usage

Example for uploading a file then sharing with link:

import owncloud

oc = owncloud.Client('http://domain.tld/owncloud')

oc.login('user', 'password')

oc.mkdir('testdir')

oc.put_file('testdir/remotefile.txt', 'localfile.txt')

link_info = oc.share_file_with_link('testdir/remotefile.txt')

print "Here is your link: http://domain.tld/owncloud/" + link_info.link

Running the unit tests

To run the unit tests, create a config file called “owncloud/test/config.py”. There is a config file example called “owncloud/test/config.py.sample”. All the information required is in that file. It should point to a running ownCloud instance to test against.

You might also need to install the unittest-data-provider package:

$ pip install unittest-data-provider

Then run the script “runtests.sh”:

$ ./runtests.sh

Building the documentation

To build the documentation, you will need to install Sphinx and docutil. Then run the following commands:

$ sphinx-apidoc -e -f -o docs/source owncloud/ owncloud/test
$ cd docs
$ make html

You can then find the documentation inside of “doc/build/html”.

Contributors

Contributors

Changelog

0.2

  • Webdav COPY support [individual-it]

  • Added API for federated sharing [nickvergessen]

  • Fix login issue in case of failed login [individual-it]

  • Added function to get capabilities [SergioBertolinSG]

  • Added subadmin APIs for provisioning API [svigneux]

  • Tests for provisioning API [individual-it]

  • Added provisioning API functions [jennifer]

  • Code cleanup / PEP8 formatting [jennifer]

  • Added status check function [soalhn]

  • Added share API functions [soalhn] [SergioBertolinSG]

  • Travis integration [Gomez]

  • Added session handling workaround for OC 5 [PVince81]

  • Fixed many issues related to unicode path names [PVince81]

  • Client now works properly on Windows [PVince81]

0.1

  • Make python egg [PVince81]

  • Initial release [PVince81]

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

pyocclient-0.2.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyocclient-0.2-py2.7.egg (49.1 kB view details)

Uploaded Egg

File details

Details for the file pyocclient-0.2.tar.gz.

File metadata

  • Download URL: pyocclient-0.2.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyocclient-0.2.tar.gz
Algorithm Hash digest
SHA256 0e43229380605b3a14383a02c4ff827a4e9aa610002afb83382ac5fa8381a182
MD5 702f831c082644cab05822a346e6a983
BLAKE2b-256 309e082ff1f835def9286701dc64e1eb8f37d35ef76493a5d8f3eb410cb60828

See more details on using hashes here.

File details

Details for the file pyocclient-0.2-py2.7.egg.

File metadata

  • Download URL: pyocclient-0.2-py2.7.egg
  • Upload date:
  • Size: 49.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyocclient-0.2-py2.7.egg
Algorithm Hash digest
SHA256 917c926e6d07c263dc65b9bdd5a4103bff8854a7e6fc68ac08255002443abf67
MD5 6799e17014bf79096bc59806b6fd2c6a
BLAKE2b-256 d0ef867db803ffa746e0f3da9c6b20f10d1cca31bcff3079efe1c15cba111407

See more details on using hashes here.

Supported by

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