https://github.com/hydroshare/old_hs_restclient
Python client library for HydroShare's REST API
https://github.com/hydroshare/old_hs_restclient
Last synced: about 1 year ago
JSON representation
Python client library for HydroShare's REST API
- Host: GitHub
- URL: https://github.com/hydroshare/old_hs_restclient
- Owner: hydroshare
- Created: 2014-03-26T15:09:21.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-03-26T18:55:34.000Z (about 12 years ago)
- Last Synced: 2025-01-27T22:47:50.019Z (over 1 year ago)
- Language: Python
- Size: 137 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
hs_restclient
=============
Python client library for HydroShare's REST API
Questions? brian_miles@unc.edu
## To run tests
python setup.py test
## To use
# Initialize
from hs_restclient import HydroShare
hs = HydroShare('http://127.0.0.1:8001/api/v1/', user_name='hs', password='water')
# Create resource
res = hs.createResource('created with API', filename='to.zip')
res.id
res.title
# Read resource
res2 = hs.getResource(id)
res
res2
res2.title
res2.writeFile('from.zip')
# Update resource
res2.title = mynewtitle
res2 = hs.updateResource(res2)
# Delete resource
result = hs.deleteResource(res2)
if not result: print('Error deleting resource')