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

Use python-requests instead of urllib/urllib2 #104

Closed
emijrp opened this issue Jun 25, 2014 · 15 comments
Closed

Use python-requests instead of urllib/urllib2 #104

emijrp opened this issue Jun 25, 2014 · 15 comments

Comments

@emijrp
Copy link
Member

emijrp commented Jun 25, 2014

From nemow...@gmail.com on February 27, 2014 01:08:47

Smart folks nowadays only use Requests, we should probably adopt it everywhere. It may be one thing more to import for our users but let's track how many things it will probably help with.

Original issue: http://code.google.com/p/wikiteam/issues/detail?id=104

@emijrp
Copy link
Member Author

emijrp commented Jun 25, 2014

From nemow...@gmail.com on February 26, 2014 16:11:06

Blocking: wikiteam:46

@emijrp
Copy link
Member Author

emijrp commented Jun 25, 2014

From nemow...@gmail.com on February 26, 2014 16:11:06

Blocking: wikiteam:103

@emijrp
Copy link
Member Author

emijrp commented Jun 25, 2014

From nemow...@gmail.com on February 26, 2014 16:11:16

Blocking: wikiteam:102

@emijrp
Copy link
Member Author

emijrp commented Jun 25, 2014

From nemow...@gmail.com on February 26, 2014 16:11:16

Blocking: wikiteam:78

@emijrp
Copy link
Member Author

emijrp commented Jun 25, 2014

From nemow...@gmail.com on June 04, 2014 06:23:03

Summary: Use python-requests instead of urllib/urllib2 (was: Reasons to use python-requests instead of urllib/urllib2)

@nemobis
Copy link
Member

nemobis commented Jun 30, 2014

balrog is mostly done implementing this, hurray! He also has fixed some Unicode handling bugs while at it (perhaps some of those have been separately fixed in master my emijrp though). Watch your patches to avoid overlapping work in the next day or so.

@balr0g
Copy link
Contributor

balr0g commented Jun 30, 2014

I'm also trying to rewrite this to use argparse to prevent other issues — currently the argument-parsing code is quite a mess.

@nemobis
Copy link
Member

nemobis commented Jun 30, 2014

balr0g, 01/07/2014 00:39:

I'm also trying to rewrite this to use argparse to prevent other issues
— currently the argument-parsing code is quite a mess.

Great. That's #115 . So many
bugs at once. :-)

@Hydriz Hydriz added this to the 0.3 milestone Jul 2, 2014
@nemobis
Copy link
Member

nemobis commented Jul 4, 2014

@balr0g, I get:

$ python dumpgenerator.py --xml --images --api=http://www.wikihow.com/api.php
You didn't provide a path for index.php, using http://www.wikihow.com/index.php
Traceback (most recent call last):
File "dumpgenerator.py", line 1291, in
main()
File "dumpgenerator.py", line 1245, in main
config, other = getParameters(params=params)
File "dumpgenerator.py", line 947, in getParameters
if checkAPI(config['api'], config, session=other['session']):
File "dumpgenerator.py", line 970, in checkAPI
r = session.post(url=api, data={'action': 'query', 'meta': 'siteinfo', 'format': 'json'})
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 241, in post
return self.request('post', url, data=data, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 194, in request
self.cookies.update(r.response.cookies)
AttributeError: MozillaCookieJar instance has no attribute 'update'
$ python --version
Python 2.7.3

@emijrp
Copy link
Member Author

emijrp commented Jul 4, 2014

Can you please stop the dump generation until we finish the major revamp we are doing, and publish a tested and stable version?

@nemobis
Copy link
Member

nemobis commented Jul 4, 2014

Emilio J. Rodríguez-Posada, 04/07/2014 14:36:

Can you please stop the dump generation until we finish the major revamp
we are doing, and publish a tested and stable version?

That was only a test, I'm running the old code now for the dumps.

@balr0g
Copy link
Contributor

balr0g commented Jul 4, 2014

@nemobis: I think you're running an old version of Requests: https://github.com/kennethreitz/requests/issues/1711

@nemobis
Copy link
Member

nemobis commented Jul 4, 2014

balr0g, 04/07/2014 16:28:

@nemobis https://github.com/nemobis: I think you're running an old
version of Requests: kennethreitz/requests#1711
https://github.com/kennethreitz/requests/issues/1711

Probably; I didn't install it on that machine. Can we check for the
requests version and fallback in some way or give upgrade directions? That is "pip install --user --upgrade requests" :)

We have people running dumpgenerator on python 2.6 still...

@balr0g
Copy link
Contributor

balr0g commented Jul 4, 2014

pip install --upgrade -r requirements.txt

nemobis added a commit that referenced this issue Jul 5, 2014
@nemobis
Copy link
Member

nemobis commented Jul 5, 2014

OK, saw 1391cf8 now; added to https://github.com/WikiTeam/wikiteam/blob/master/README.md#download-any-wiki.
I'm closing this, let's go through the dependencies (#46, #103, #102, #78) and file issues separately.

@nemobis nemobis closed this as completed Jul 5, 2014
nemobis added a commit that referenced this issue Jul 5, 2014
Per emijrp who asked not to run dumps with this, at #104 (comment)
Currently proposed things to fix or check: https://github.com/WikiTeam/wikiteam/issues?milestone=1&state=open
gausie pushed a commit to gausie/wikiteam that referenced this issue Nov 18, 2023
…ikiTeam#104)

Truncate filename are unnecessary.

1. Most file systems limit filename to 255 _bytes_ (NTFS is 255
_characters_).
2. MediaWiki restricts filename to [no longer than 240
bytes](https://static-codereview.wikimedia.org/MediaWiki/98430.html).
3. Python3 on Windows can handle [extended-length
path](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation)
automatically.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants