You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-8Lines changed: 17 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,22 @@
1
1
# hsclient
2
-
A python client for interacting with HydroShare in an object oriented way.
2
+
A python client for interacting with HydroShare in an object oriented way. The hsclient Python package can be use to create, modify, and interact with HydroShare resources. It was designed to allow you to write code to do pretty much everything you can do through HydroShare's web user interface.
3
3
4
4
## Jupyter Notebooks
5
-
HydroShare has a resource with example notebooks. Click [here](https://www.hydroshare.org/resource/7561aa12fd824ebb8edbee05af19b910/) then click the blue `Open with...` dropdown and select `Cuahsi Jupyterhub` to launch the notebooks into a Jupyter Environmentto start using this project.
5
+
HydroShare has a resource with example Jupyter notebooks for using hsclient. Click [here](https://www.hydroshare.org/resource/7561aa12fd824ebb8edbee05af19b910/) then click the blue `Open with...` dropdown at the top of the page and select `Cuahsi Jupyterhub` to launch the notebooks into HydroShare's linked Jupyter Environment. [Click here](https://help.hydroshare.org/apps/CUAHSI-JupyterHub/) for information on how to access the HydroShare linked JupyterHub environment.
6
6
7
7
8
-
## Install the HS RDF HydroShare Python Client
9
-
The HS RDF Python Client for HydroSharewon't be installed by default, so it has to be installed first before you can work with it. Use the following command to install the Python Client from the GitHub repository. Eventually we will distribute this package via the Python Package Index (PyPi) so that it can be installed via pip from PyPi.
8
+
## Install the hsclient HydroShare Python Client
9
+
The hsclient package is installed already in HydroShare's linked JupyterHub Python environment. However, if you want to use hsclient outside of that Python environment, hsclient won't be installed by default. You'll need to install it before you can work with it. Use the following command to pip install hsclient from the Python Package Index (PyPI). You can also use the package manager for your interactive development environment to do this.
10
10
11
11
```bash
12
12
pip install hsclient
13
13
```
14
14
15
-
## Authenticate with HydroShare
15
+
## Getting Started and Documentation
16
+
17
+
The following are quick examples of how to get started with hsclient. Refer to the Jupyter notebooks above for more extensive examples. [Click here](https://hydroshare.github.io/hsclient/) to access documentation for hsclient.
18
+
19
+
### Authenticate with HydroShare
16
20
Before you start interacting with resources in HydroShare you will need to authenticate.
17
21
```python
18
22
from hsclient import HydroShare
@@ -21,7 +25,7 @@ hs = HydroShare()
21
25
hs.sign_in()
22
26
```
23
27
24
-
## Create a New Empty Resource
28
+
###Create a New Empty Resource
25
29
A "resource" is a container for your content in HydroShare. Think of it as a "working directory" into which you are going to organize the code and/or data you are using and want to share. The following code can be used to create a new, empty resource within which you can create content and metadata.
26
30
27
31
This code creates a new resource in HydroShare. It also creates an in-memory object representation of that resource in your local environmment that you can then manipulate with further code.
@@ -37,12 +41,12 @@ print('The HydroShare Identifier for your new resource is: ' + resIdentifier)
37
41
print('Your new resource is available at: '+ new_resource.metadata.url)
38
42
```
39
43
40
-
# Creating and Editing Resource Metadata Elements
44
+
###Creating and Editing Resource Metadata Elements
41
45
Editing metadata elements for a resource can be done in an object oriented way. You can specify all of the metadata elements in code, which will set their values in memory in your local environment. Values of metadata elements can be edited, removed, or replaced by setting them to a new value, appending new values (in the case where the metadata element accepts a list), or by removing the value entirely.
42
46
43
47
When you are ready to save edits to metadata elements from your local environment to the resource in HydroShare, you can call the save() function on your resource and all of the new metadata values you created/edited will be saved to the resource in HydroShare.
44
48
45
-
## Resource Title and Abstract
49
+
###Resource Title and Abstract
46
50
The Title and Abstract metadata elements can be specified as text strings. To modify the Title or Abstract after it has been set, just set them to a different value.
This material is based upon work supported by the National Science Foundation (NSF) under awards [1931278](https://www.nsf.gov/awardsearch/showAward?AWD_ID=1931278) and [1931297](https://www.nsf.gov/awardsearch/showAward?AWD_ID=1931297). Any opinions, findings, conclusions, or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the NSF.
0 commit comments