hydroshare / hs_restclient

Python client for the https://www.hydroshare.org REST API
BSD 3-Clause "New" or "Revised" License
6 stars 8 forks source link

Expectation when the credentials are not correct in HTTP Basic authentication #101

Open amabdallah opened 5 years ago

amabdallah commented 5 years ago

This authentication methods needs to return an error message if the username or pass do not match with HydroShare.

Right now, either way, "hs" returns a value. Not sure whats the best way to programatcily catch an expectation when the credentials are not correct.

To authenticate using HTTP Basic authentication, and then get a list of resources you have access to:

from hs_restclient import HydroShare, HydroShareAuthBasic
auth = HydroShareAuthBasic(username='myusername', password='mypassword')
hs = HydroShare(auth=auth)
for resource in hs.getResourceList():
    print(resource)