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

Cannot upload - Receive the following errors #1

Open
romeosidvicious opened this issue Feb 28, 2012 · 2 comments
Open

Cannot upload - Receive the following errors #1

romeosidvicious opened this issue Feb 28, 2012 · 2 comments

Comments

@romeosidvicious
Copy link

I have blanked out the password in the following errors. I know it is loging in correctly as I can put in a bad password and receive a log in error rather than the errors below. The wiki is setup to allow .ods to be uploaded.

mediawiki_upload.py -u mpotter -p -w http:///w/api.php ifsapps.ods
Traceback (most recent call last):
File "/ifs/home/mpotter/Downloads/bit-mediawiki_upload-1f3b898/mediawiki_upload.py", line 300, in
upload_file(filename, opts.username, opts.password, opts.url, opts.license)
File "/ifs/home/mpotter/Downloads/bit-mediawiki_upload-1f3b898/mediawiki_upload.py", line 270, in upload_file
r = wiki.upload(filename, 'Initial Upload', description)
File "/ifs/home/mpotter/Downloads/bit-mediawiki_upload-1f3b898/mediawiki_upload.py", line 195, in upload
token = self.get_token(pagename, 'edit')
File "/ifs/home/mpotter/Downloads/bit-mediawiki_upload-1f3b898/mediawiki_upload.py", line 188, in get_token
})['query']['pages']['-1']['edittoken'])
KeyError: '-1'

@bit
Copy link
Owner

bit commented Feb 28, 2012

can you pull 3f0ee67 and run it with --debug to see what the api resonse is for the get_token call?
the error you see could be because a file with the name you try to upload already exists.

@romeosidvicious
Copy link
Author

Here is the use case. The file does exist. It is file that we upload once a
week manually (I just got this gig and the amount of automation they didn't
have is amazing). So in short the file does exist. However reading the API
documentation I have added the following to LocalSettings.php:

$wgAllowCopyUploads = true;
$wgGroupPermissions['autoconfirmed']['reupload'] = true;
$wgGroupPermissions['autoconfirmed']['upload'] = true;
$wgStrictFileExtensions = false;
$wgAllowAsyncCopyUploads = true;
$wgCheckFileExtensions = false;

The second one there should allow me to upload files that already exist if
I am reading the documentation correcty. Here is the output of 3f0ee67 with
debug on the file I am trying to work with:

./mediawiki_upload.py --debug -u mpotter -p -d -w
http://10.64.15.227/w/api.php ifshome.ods
{"login":{"result":"NeedToken","token":"d369e3ed418f2f2656ab3d7fc37f024b","cookieprefix":"my_wiki","sessionid":"vnu6j42aefmif9vqfpjpp99u55"}}
{"login":{"result":"Success","lguserid":5,"lgusername":"Mpotter","lgtoken":"c00218a9881e182dc066be76b4f78012","cookieprefix":"my_wiki","sessionid":"vnu6j42aefmif9vqfpjpp99u55"}}
{"query":{"normalized":[{"from":"File:ifshome.ods","to":"File:Ifshome.ods"}],"pages":{"175":{"pageid":175,"ns":6,"title":"File:Ifshome.ods","touched":"2012-02-27T14:55:27Z","lastrevid":701,"counter":4,"length":9,"starttimestamp":"2012-02-28T19:58:15Z","edittoken":"4a2c2f273a2539da9106017fd451ba50+"}}}}
Traceback (most recent call last):
File "./mediawiki_upload.py", line 302, in
upload_file(filename, opts.username, opts.password, opts.url,
opts.license)
File "./mediawiki_upload.py", line 272, in upload_file
r = wiki.upload(filename, 'Initial Upload', description)
File "./mediawiki_upload.py", line 197, in upload
token = self.get_token(pagename, 'edit')
File "./mediawiki_upload.py", line 190, in get_token
})['query']['pages']['-1']['edittoken'])
KeyError: '-1'

This is the output with a file that doesn't exist (as there is a different
problem there):

./mediawiki_upload.py --debug -u mpotter -p -d -w
http://10.64.15.227/w/api.php test.jpg
{"login":{"result":"NeedToken","token":"4bc94580f6111bde257a234b00f0f748","cookieprefix":"my_wiki","sessionid":"ipqvpajmjn6udobgdi4aqjd134"}}
{"login":{"result":"Success","lguserid":5,"lgusername":"Mpotter","lgtoken":"c00218a9881e182dc066be76b4f78012","cookieprefix":"my_wiki","sessionid":"ipqvpajmjn6udobgdi4aqjd134"}}
{"query":{"normalized":[{"from":"File:test.jpg","to":"File:Test.jpg"}],"pages":{"-1":{"ns":6,"title":"File:Test.jpg","missing":"","starttimestamp":"2012-02-28T20:01:44Z","edittoken":"da67caaef6c45d5c6f391a291d2cb95e+"}}}}
{"servedby":"10.64.15.227","error":{"code":"missingparam","info":"One of
the parameters filekey, file, url, statuskey is required"}}
{u'info': u'One of the parameters filekey, file, url, statuskey is
required', u'code': u'missingparam'}
Upload failed.

Thanks for such a quick response!

On Tue, Feb 28, 2012 at 12:40 PM, bit <
reply@reply.github.com

wrote:

can you pull 3f0ee67 and run it with --debug to see what the api resonse
is for the get_token call?
the error you see could be because a file with the name you try to upload
already exists.


Reply to this email directly or view it on GitHub:
#1 (comment)

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

2 participants