Package: pyncclient
This is a fork ofhttps://github.com/owncloud/pyocclientto provide compatibility with nextCloud, this client will not maintain compatibility to ownCloud.FeaturesGeneral informationretrieve information about nextCloud instance (e.g. version, host, URL, etc.)Accessing filesbasic file operations like getting a directory listing, file upload/download, directory creation, etcread/write file contents from stringsupload with chunking and mtime keepingupload whole directoriesdirectory download as zipaccess files from public linksupload files to files drop link targetSharing (OCS Share API)share a file/directory via public linkshare a file/directory with another user or groupunshare a file/directorycheck if a file/directory is already sharedget information about a shared resourceupdate properties of a known shareApps (OCS Provisioning API)enable/disable appsretrieve list of enabled appsUsers (OCS Provisioning API)create/delete userscreate/delete groupsadd/remove user from groupsApp datastore app data as key/values using the privatedata OCS APIRequirementsPython >= 2.7 or Python >= 3.5requests module (for making HTTP requests)InstallationAutomatic installation with pip:$pipinstallpyncclientManual installation of development version with git:$pipinstallrequests$gitclonehttps://github.com/pragmaticindustries/pyncclient.git$cdpyncclient$pythonsetup.pyinstallUsageExample for uploading a file then sharing with link:importnextcloud_clientnc=nextcloud_client.Client('http://domain.tld/nextcloud')nc.login('user','password')nc.mkdir('testdir')nc.put_file('testdir/remotefile.txt','localfile.txt')link_info=nc.share_file_with_link('testdir/remotefile.txt')print("Here is your link: "+link_info.get_link())Example for uploading a file to a public shared folder:importnextcloud_clientpublic_link='http://domain.tld/nextcloud/A1B2C3D4'nc=nextcloud_client.Client.from_public_link(public_link)nc.drop_file('myfile.zip')Example for downloading a file from a public shared folder with password:importnextcloud_clientpublic_link='http://domain.tld/nextcloud/A1B2C3D4'folder_password='secret'nc=nextcloud_client.Client.from_public_link(public_link,password=folder_password)nc.get_file('/sharedfile.zip','download/destination/sharedfile.zip')Running the unit testsTo run the unit tests, create a config file called “nextcloud_client/test/config.py”.
There is a config file example called “nextcloud_client/test/config.py.sample”. All the
information required is in that file.
It should point to a running nextCloud instance to test against.You might also need to install the unittest-data-provider package:$pipinstallunittest-data-providerThen run the script “runtests.sh”:$./runtests.shBuilding the documentationTo build the documentation, you will need to install Sphinx and docutil.
Then run the following commands:$sphinx-apidoc-e-f-odocs/sourcenextcloud_client/nextcloud_client/test$cddocs$makehtmlYou can then find the documentation inside of “doc/build/html”.ContributorsContributorsMarco Mastasi <m.nastasi@pragmaticminds.de>Changelog0.7
–
- Made initial changes for nextCloud compatibility0.6Added support to query arbitrary properties with file info and file listing [NikosChondros]Added support for file operations within a public link [mrwunderbar666]0.5Added “name” attribute for public links [PVince81]Fixed deprecation warnings [Tilman Lüttje] [PVince81]Added support sharing with federated users [remjg]Fixed setup script for utf-8 paths [amicitas]Fixed file mtime parsing issue [viraj96]Add support for the server’s DAV v2 endpoint [PVince81]Remove support for ownCloud 8.1, 9.0 and 9.1 which are EOL [PVince81]0.4Some code cleanup removing needless if statements [jamescooke]Remove old session_mode [PVince81]Set Depth to 0 in file_info call [PVince81]Make subclassing of Client event easier with protected methods [bobatsar]0.3Make subclassing of Client easier [bobatsar]Add Depth param for recursive listing [bobatsar]Add shared_with_me parameter to get_shares [bobatsar]Link variable is now called url inside of shareinfo [SergioBertolinSG]Python3 support [ethifus] [Blizzz]0.2Webdav 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.1Make python egg [PVince81]Initial release [PVince81]