diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ed521e1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "hsclient"] + path = hsclient + url = https://github.com/hydroshare/hsclient.git diff --git a/README.md b/README.md index 8adc153..0e6958f 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,9 @@ pip install --upgrade pip # install nbfetch in edit mode pip install -e . +# install hsclient fork +pip install -e hsclient + # enable jupyter_server extension jupyter server extension enable --py nbfetch diff --git a/hsclient b/hsclient new file mode 160000 index 0000000..099e242 --- /dev/null +++ b/hsclient @@ -0,0 +1 @@ +Subproject commit 099e242706d850847f728db3c5dff791178efe98 diff --git a/nbfetch/handlers.py b/nbfetch/handlers.py index cf59291..ff0d417 100644 --- a/nbfetch/handlers.py +++ b/nbfetch/handlers.py @@ -22,6 +22,12 @@ # typing imports from typing import Optional, Tuple +# probably need a varify=False for the hs client session? ssl cert... +host = "www2-hydroshare.edc.renci.org" +# host = "beta.hydroshare.org" +protocol = "https" +port = 443 + class ExtensionHandler( ExtensionHandlerMixin, ExtensionHandlerJinjaMixin, JupyterHandler @@ -311,9 +317,9 @@ def check_auth(self, authfile=None, username=None, password=None): if authfile: with open(authfile, 'rb') as f: token, cid = pickle.load(f) - hs = HydroShare(client_id=cid, token=token) + hs = HydroShare(client_id=cid, token=token, host=host, protocol=protocol, port=port) else: - hs = HydroShare(username=username, password=password) + hs = HydroShare(username=username, password=password, host=host, protocol=protocol, port=port) self.log.info('hs=%s' % str(hs)) info = hs.my_user_info() @@ -376,7 +382,7 @@ def get(self): id = self.get_argument("id") # check to see if the resource is public - hs = HydroShare() + hs = HydroShare(host=host, protocol=protocol, port=port) try: hs.resource(id) self.log.info(f"Pulling public rid {id}. \ @@ -428,7 +434,7 @@ def get(self): path = urljoin(self.base_url, path) self.redirect(path) return - + # self.write( self.render_template( "hstatus.html",