Last modified: 2014-10-06 11:33:41 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T73497, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 71497 - SSLError on requesting data from Wikidata
SSLError on requesting data from Wikidata
Status: RESOLVED WORKSFORME
Product: Pywikibot
Classification: Unclassified
network (Other open bugs)
core-(2.0)
All All
: Unprioritized normal
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-10-01 09:46 UTC by Lokal_Profil
Modified: 2014-10-06 11:33 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Lokal_Profil 2014-10-01 09:46:31 UTC
When trying to get() an item from wikidata I get the following SSL related error:

ERROR: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pywikibot-2.0b1-py2.7.egg/pywikibot/data/api.py", line 452, in submit
    headers=headers, body=body)
  File "/usr/local/lib/python2.7/dist-packages/pywikibot-2.0b1-py2.7.egg/pywikibot/tools.py", line 367, in wrapper
    return method(*__args, **__kw)
  File "/usr/local/lib/python2.7/dist-packages/pywikibot-2.0b1-py2.7.egg/pywikibot/comms/http.py", line 258, in request
    raise request.data
SSLError: [Errno 185090050] _ssl.c:344: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib


To reproduce:
import pywikibot
repo = pywikibot.Site().data_repository()
item = pywikibot.ItemPage(repo, 'Q4115189')
item.get()
Comment 1 Mpaa 2014-10-04 21:59:30 UTC
Work for me with:
>>> pywikibot.version.getversion()
u'[ssh] pywikibot-core.git (a5744db, g4204, 2014/10/04, 18:56:45, OUTDATED)'
Comment 2 Fabian 2014-10-04 22:14:35 UTC
Does this happen also when calling pywikibot.version.getversion()?
Comment 3 Merlijn van Deen (test) 2014-10-04 22:22:24 UTC
Apparently this is what you get if your certificates file is missing. What version of httplib2 do you have installed, and was it installed by a package manager or with pip?

In the latter case, please pip install --upgrade httplib2; in the former case, a bug report for your distribution might be in order.
Comment 4 Lokal_Profil 2014-10-06 09:36:59 UTC
@Fabian: SSL issue doesn't happen when I call pywikibot.version.getversion()

@Merlijn: Running "pip install --upgrade httplib2" didn't help (and on searching I find cacert.pem in the requests directory).

Completely reinstalled pywikibot (to try and remove any issues related to the egg installer but still the same issue.

u'[ssh] pywikibot-core.git (df93880, g4208, 2014/10/05, 23:53:47, n/a)'

Reading a bit at https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1306991 it seems as though requests is broken for Ubuntu 14.04.
Comment 5 Lokal_Profil 2014-10-06 09:50:09 UTC
@Merlijn: running httplib2 version 0.9
Comment 6 Merlijn van Deen (test) 2014-10-06 10:14:48 UTC
Note that we use *httplib2*, not requests! Please try the following

$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import httplib2
>>> httplib2.CA_CERTS

This gives me '/etc/ssl/certs/ca-certificates.crt' for my Ubuntu 14.04-packaged httplib2, and '/path/to/venv/lib/python2.6/site-packages/httplib2-0.8_pywikibot1-py2.6.egg/httplib2/cacerts.txt' for a virtualenv.

What do you get, and does that file exist?
Comment 7 Lokal_Profil 2014-10-06 10:28:09 UTC
Sorry about that. Me getting confused between httplib and requests.

httplib2.CA_CERTS gives me /usr/local/lib/python2.7/dist-packages/httplib2-0.9-py2.7.egg/httplib2/cacerts.txt

---

I finally got things to work by deleting the httplib2 directory in the externals folder of pywikibot.
Comment 8 Lokal_Profil 2014-10-06 11:31:08 UTC
Is the httplib2 in core/externals necessary?
Comment 9 Merlijn van Deen (test) 2014-10-06 11:33:41 UTC
Yes. It's used by people using pywikibot-as-a-portable-package via pwb.py. I'm not sure why your system decided to a) use that directory (instead of using the system-installed one) or b) why it couldn't find it's cacerts file (which is included in the externals/httplib2 directory).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links