Skip to content

Instantly share code, notes, and snippets.

@cosenal
Last active August 29, 2015 14:20
Show Gist options
  • Save cosenal/817ac522e2fd6ebe22a8 to your computer and use it in GitHub Desktop.
Save cosenal/817ac522e2fd6ebe22a8 to your computer and use it in GitHub Desktop.
test osf's waterbutler owncloud provider
import asyncio
from waterbutler.providers.owncloud import OwnCloudProvider
loop = asyncio.get_event_loop()
creds = {
'owncloud': {'username': 'test', 'password': 'test'},
}
settings = {
'owncloud': {'base_url': 'http://localhost/owncloud/'},
}
owncloud = OwnCloudProvider({}, creds['owncloud'], settings['owncloud'])
print(loop.run_until_complete(owncloud.metadata('/myfile.txt')))
print(loop.run_until_complete(loop.run_until_complete(owncloud.download('/myfile.txt')).read()))
print(loop.run_until_complete(owncloud.upload(streams.StringStream('This will be the contents of newfile.txt'),
'/newfile.txt')))
print(loop.run_until_complete(owncloud.delete('/newfile.txt')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment