User talk:Martyav/Sandbox/API:Images

Jump to navigation Jump to search

About this board

SSethi (WMF) (talkcontribs)
Martyav (talkcontribs)

Here is the script I've been working on this morning. However, it prints: {'batchcomplete': '', 'query': {'pages': {'-1': {'ns': 0, 'title': 'Albert Einstein', 'missing': ''}}}}

which does not seem to be correct?



MediaWiki Action API Code Samples

Demo of `Images` module: Sending GET request to images

MIT license


# Note: This code relies on the third party library, requests.

# Be sure to install it via your favorite package manager!

import requests

S = requests.Session()

URL = ""

# Send a GET request to the images endpoint.





'titles':'Albert Einstein'


R = S.get(url=URL, params=PARAMS)

DATA = R.json()


SSethi (WMF) (talkcontribs)

@Martyav Hello Marty! this is happening because you are trying to look for files on the page with title "Albert Einstein" on, though there is not a page like with this title that exists there. It is on English Wikipedia instead. So, you would have to change the endpoint url in your code.

Martyav (talkcontribs)

Ha! Thanks! I should have realized.

SSethi (WMF) (talkcontribs)

@Martyav Glad you got it to work :-) I've left some comments on your pull request. Also, improvements are welcome to the API:Images page in your Sandbox following suggestions in the comment I've added above.

SSethi (WMF) (talkcontribs)
Martyav (talkcontribs)

Thanks for merging in my changes! I felt really happy this morning.

I made the corrections and also moved around the section ordering on this page to match Didicodes.

SSethi (WMF) (talkcontribs)

Awesome! :) That makes me happy too!! User:Martyav/Sandbox/API:Images is ready to be migrated from your Sandbox to main namespace on API:Images. When you publish your changes, you want to add a comment something like: "Rewrite; using the API documentation template ( to format this page" (see my last edit here: Also, then you can update the Phabricator task and your name in the "Done" column

Reply to "Feedback 1.0"
There are no older topics