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

[Newbie] TypeError: __init__() got an unexpected keyword argument 'scheme' #405

Open
losershutin opened this issue Apr 9, 2021 · 7 comments

Comments

@losershutin
Copy link

I'm completely new to using Python programs, so I might be doing something completely wrong. I have nothing else to add except my Command Prompt log. I'm using Windows, by the way.

Analysing https://trollpasta.miraheze.org/w/api.php
Trying generating a new dump into a new directory...
Loading page titles from namespaces = all
Excluding titles from namespaces = None
28 namespaces found
Retrieving titles in the namespace 0
Traceback (most recent call last):
File "dumpgenerator.py", line 2569, in
main()
File "dumpgenerator.py", line 2561, in main
createNewDump(config=config, other=other)
File "dumpgenerator.py", line 2126, in createNewDump
getPageTitles(config=config, session=other['session'])
File "dumpgenerator.py", line 391, in getPageTitles
for title in titles:
File "dumpgenerator.py", line 261, in getPageTitlesAPI
site = mwclient.Site(apiurl.netloc, apiurl.path.replace("api.php", ""), scheme=apiurl.scheme)
TypeError: init() got an unexpected keyword argument 'scheme'

@nemobis
Copy link
Member

nemobis commented Apr 9, 2021 via email

@losershutin
Copy link
Author

losershutin commented Apr 9, 2021

What version of mwclient have you installed?

I have mwclient 0.6.5 installed.

@nemobis
Copy link
Member

nemobis commented Apr 11, 2021 via email

@GreenReaper
Copy link

I faced the same issue due to the deprecation of Python 2.7 in FreeBSD; the one I found was mwlib 0.9.3.

I got it working by modifying the end of the line starting def __init__ in /usr/local/lib/python2.7/site-packages/mwclient/client.py to end with scheme='https'): You may not have the same path to the file, but if you can find it, it might work for you.

If the scheme you have to use is actually http you may want to modify the line scheme = 'https' in def raw_call as well.

I also commented out from requests_oauthlib import OAuth1 because I couldn't be bothered to get all OAuth libraries and they did not seem to be required for a simple download.

Obviously, what nemobis suggests is better, but the above may be faster.

@nemobis
Copy link
Member

nemobis commented May 9, 2021 via email

@WAUthethird
Copy link

I've been trying to get this working with EditThis. mwclient only supports MediaWiki 1.16 and upwards in latest, while EditThis runs MediaWiki 1.15.

So, since the last mwclient that supports MediaWiki 1.15 was 0.6.5, released in 2011, I've been having trouble getting it to work with the latest dumpgenerator.

When was the scheme stuff implemented? @GreenReaper's solution does not work as 0.6.5 is much older than 0.9.3, so I'm curious what version of dumpgenerator I should be using with mwclient 0.6.5.

@nemobis
Copy link
Member

nemobis commented Nov 15, 2021

mwclient only supports MediaWiki 1.16 and upwards in latest

That's a different matter. We probably need to pin a previous version or avoid using mwclient if we can't use it any more for older wikis...

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

4 participants