Password authentication for securely hosted ontologies

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Password authentication for securely hosted ontologies

Khalid
Hello,

I work in an organization where the ontologies are hosted on password protected servers. Is there any plan to introduce an authorization header in the get_ontology() function such that it passes the authentication details when making the request from the server and also cascades this authentication to any of the imported ontologies?

Thank you,
Khalid
Reply | Threaded
Open this post in threaded view
|

Re: Password authentication for securely hosted ontologies

Jiba
Administrator
Hello,

What kind of password are you using? Owlready uses Python module urllib and urllib.request.urlopen() for loading ontologies, so you can use install_opener() for Basic HTTP Authentication.

Here is an example from the Python doc:

import urllib.request
# Create an OpenerDirector with support for Basic HTTP Authentication...
auth_handler = urllib.request.HTTPBasicAuthHandler()
auth_handler.add_password(realm='PDQ Application', uri='https://mahler:8092/site-updates.py', user='klem', passwd='kadidd!ehopper')
opener = urllib.request.build_opener(auth_handler)

# ...and install it globally so it can be used with urlopen.
urllib.request.install_opener(opener)
urllib.request.urlopen('http://www.example.com/login.html')

Instead of calling urllib.request.urlopen() at the end, you can call get_ontology(), which in turn call urlopen().

Jiba