Closed amabdallah closed 3 years ago
that endpoint performs terribly when no filters are provided. Try listing just published resource
for resource in hs.resources(published=True):
print(resource)
This is an issue we're working through, but filtering your resources will help you for now.
@sblack-usu thank you, it worked. What I'm trying to do as a first step here is just to connect to hs and validate user credentials. Is there a better way to do that? Ideally there should be a parameter coming back with valid or invalid connection value and I can just look into it without needing to do this hs.resources().
I added a break, for now, to stop the for loop after getting the first resource which implicitly means the credentials are valid
for resource in hs.resources(published=True): print("success") self.btn_login.Enabled = False break
@amabdallah Take a look at how I validate user credentials in the hstools
application: https://github.com/Castronova/hstools/blob/master/hstools/auth.py. After I instantiate a connection with HydroShare, I make a simple getUserInfo
request. This request raises an exception if the login failed
try:
a = hs_restclient.HydroShareAuthBasic(username=creds['usr'], password=creds['pwd'])
hs = hs_restclient.HydroShare(auth=a)
hs.getUserInfo()
return hs
except Exception as e:
raise Exception(e)
that endpoint performs terribly when no filters are provided. Try listing just published resource
for resource in hs.resources(published=True): print(resource)
This is an issue we're working through, but filtering your resources will help you for now.
@sblack-usu Not sure if you saw this in the HydroShare project, but we might need to take a close look at the resource filtering logic. It appears that the published
filter is returning non-published resources: https://github.com/hydroshare/hydroshare/issues/3868
https://github.com/hydroshare/hydroshare/pull/3880 addresses the performance of the resources endpoint. It will be included in the next release in the coming weeks.
Hi @sblack-usu and @Castronova
Any clue why I'm getting this error message? It's the very basic code to access my account
username = 'username'
password = 'password'
auth = HydroShareAuthBasic(username=username, password=password)
hs = HydroShare(auth=auth)
for resource in hs.resources(): print 'Connected to HydroShare'