setCredentials is detached from endpoints
SPARQLWrapper takes endpoint and updateEndpoint URLs as parameters of constructor
separately, it has method named setCredentials which allows to specify login/password which are used for Basic Authentication.
There are 2 problems with this:
- it is possible to have endpoints for queries and updates which require different credentials and current implementation doesn't provide good solution for this case
- endpoints might use different authentication schemes (Digest Authentication, OAuth, …)
I propose to separate 3 entities:
- Set of classes which implement informal
Authenticationprotocol (I wonder if we can reuse some existing package for this) -
Endpointclass which implements SPARQL 1.1 Protocol which take Auth-object as parameter and takes care of HTTP part -
Wrapperwhich takes 1 or 2 Endpoint-objects as parameters and provides user-friendly API
This approach will also allow us to add endpoint implementations which use custom triplestore-specific protocols as a bonus.
This is a large change, so should be implemented in 2.x branch.
I'm aware of the issue. But I'd need some more time for thinking an appropriate solution.
@wikier do you think that my proposal won't be suitable?
I, actually, have 2 very specific use-cases related to this issue:
- SPARQL-endpoint protected by OAuth 1.0a
- SPARQL-proxy implemented via custom (not HTTP) protocol