Comments (7)
seems related to #55
from sparqlwrapper.
Perfect, it's exactly what I suspect, I change and now it works perfectly.
from sparqlwrapper.
But I have another problem you can add to resolve in a row,
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>
(Because now I'm using a test server with no ssl certificate.)
I solve this replacing line 537 in Wrapper.py with:
import ssl
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urlopener(request, context=ctx)
from sparqlwrapper.
hmm, might be an ad-hoc fix for you, but i'm against adding this by default as it disables SSL certificate verification
from sparqlwrapper.
I think adding an option will be very useful, an option that is visible only if people need it. Obviously the standard setting will be to check SSL cert.
from sparqlwrapper.
Definitely need an option to specify some SSL related parameters. Either a verify='/path/to/public_key.pem'
or a verify = False
from sparqlwrapper.
first, let me point you to https://www.python.org/dev/peps/pep-0476/
python by default uses and verifies the system provided ssl certs, which is a good thing.
if you want to ignore ssl verification for whatever reason you can already achieve this right now (but you should not) by using the 2nd attempt mentioned in https://www.python.org/dev/peps/pep-0476/#opting-out .
Another (IMO) much better approach is to actually verify the certificate with the help of the following two environment variables SSL_CERT_DIR
and SSL_CERT_FILE
:
$ python -c 'import ssl ; print ssl.get_default_verify_paths()'
DefaultVerifyPaths(cafile='/usr/local/etc/openssl/cert.pem', capath='/usr/local/etc/openssl/certs', openssl_cafile_env='SSL_CERT_FILE', openssl_cafile='/usr/local/etc/openssl/cert.pem', openssl_capath_env='SSL_CERT_DIR', openssl_capath='/usr/local/etc/openssl/certs')
$ SSL_CERT_DIR='/some/cert/dir' SSL_CERT_FILE='/some/cert/file.pem' python -c 'import ssl ; print ssl.get_default_verify_paths()'
DefaultVerifyPaths(cafile='/some/cert/file.pem', capath='/some/cert/dir', openssl_cafile_env='SSL_CERT_FILE', openssl_cafile='/usr/local/etc/openssl/cert.pem', openssl_capath_env='SSL_CERT_DIR', openssl_capath='/usr/local/etc/openssl/certs')
that said, i'm not against the possibility of customizing request parameters in any way. I'm just strongly against offering a default "ignore ssl" flag, which might give a false impression that it's somehow ok or a common case to ignore ssl errors.
So if someone wants to go ahead and allow passing along more options to urlopener
, e.g. a context
i won't stand in the way. What you should know though is that it long term SPARQLWrapper will probably base on the requests
library (see #51), so maybe this is just a minor add-on then.
from sparqlwrapper.
Related Issues (20)
- Next Release? HOT 20
- Introduce Lint tools
- Convert SPARQLWrapper.SmartWrapper to pandas dataframe HOT 6
- Removing https://rdflib.github.io/sparqlwrapper HOT 4
- Documentation format HOT 4
- using "describe" in a comment leads to error HOT 12
- Organize old PRs/Issues
- Make tests faster and more reliable.
- TLS changes in Python 3.10, insecure endpoint
- Allow earlier versions of rdflib HOT 2
- Test failures probably due to remote service issues
- Cannot install with conda for Python >=3.10 HOT 2
- QueryBadFormed: A bad request has been sent to the endpoint
- WikiData Not Returning CSV HOT 1
- Can't use SPARQLWrapper in nix-shell (somewhat OT)
- AWS Signature Version 4 Authentication Support HOT 2
- Align query result types with rdflib
- Unable to query the rdf:type HOT 3
- 405 (Method not allowed) for SELECT QUERY with # street address in comment HOT 2
- GraphDB 10.2.2: b'Missing parameter: query' on INSERT HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sparqlwrapper.