Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wikitools.wiki.Wiki for biografias.bcn.cl: Invalid JSON #55

Open
nemobis opened this issue May 17, 2018 · 1 comment
Open

wikitools.wiki.Wiki for biografias.bcn.cl: Invalid JSON #55

nemobis opened this issue May 17, 2018 · 1 comment

Comments

@nemobis
Copy link
Contributor

nemobis commented May 17, 2018

>>> import wikitools
>>> site = wikitools.wiki.Wiki('http://biografias.bcn.cl/api.php')
Invalid JSON, trying request again
Invalid JSON, trying request again
Invalid JSON, trying request again
Invalid JSON, trying request again
Invalid JSON, trying request again
^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/federico/.local/lib/python2.7/site-packages/wikitools/wiki.py", line 95, in __init__
    self.setSiteinfo()
  File "/home/federico/.local/lib/python2.7/site-packages/wikitools/wiki.py", line 113, in setSiteinfo
    info = req.query(False)
  File "/home/federico/.local/lib/python2.7/site-packages/wikitools/api.py", line 158, in query
    rawdata = self.__getRaw()
  File "/home/federico/.local/lib/python2.7/site-packages/wikitools/api.py", line 270, in __getRaw
    data = gzip.GzipFile('', 'rb', 9, StringIO.StringIO(data.read()))
  File "/usr/lib64/python2.7/socket.py", line 355, in read
    data = self._sock.recv(rbufsize)
  File "/usr/lib64/python2.7/httplib.py", line 597, in read
    s = self.fp.read(amt)
  File "/usr/lib64/python2.7/socket.py", line 384, in read
    data = self._sock.recv(left)
KeyboardInterrupt

Note, this wiki has some weird webserver configuration which causes several problems. Apparently, api.php returns the HTML main page if you attempt to POST any data instead of POSTing the API parameters as URL parameters. I'm not sure that's the culprit though.

From WikiTeam/wikiteam#314

@nemobis
Copy link
Contributor Author

nemobis commented Feb 8, 2020

Same in a MediaWiki 1.34 wiki:

Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wikitools
>>> site = wikitools.wiki.Wiki("http://luz.izt.uam.mx/wikis/mediawiki/api.php")
Invalid JSON, trying request again
Invalid JSON, trying request again
Invalid JSON, trying request again
Invalid JSON, trying request again
HTTPError: HTTP Error 301: The HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
Moved Permanently trying request again in 5 seconds
HTTPError: HTTP Error 301: The HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
Moved Permanently trying request again in 10 seconds
HTTPError: HTTP Error 301: The HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
Moved Permanently trying request again in 15 seconds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant