Jump to content

Topic on User talk:Itskoda/Sandbox/API:Assert/Flow

SSethi (WMF) (talkcontribs)

Thanks for working on this! A few suggestions:

Itskoda (talkcontribs)

Thanks! I made the changes to match the Documentation template. Is it better now? What should I do next?

SSethi (WMF) (talkcontribs)

@Itskoda Great! Some suggestions for small changes:

  • We don't need to show error response in the `Response` section for both requests. Only show the response we get in case user is logged in or has bot right.
  • As for the API:Assert example, there are two examples to include, see how you could format the table of content as in: API:Login.
  • There is no sample code in the example section. You could write code for atleast one get request (assert=user).
  • You are missing on a parameter (action=query) in User:Itskoda/Sandbox/API:Assert#GET Request. When I click on the get request, I don't see any response.
Itskoda (talkcontribs)

I made the changes 1,2 and 4 (I believe). But I'm kinda ashamed but have to ask that even tho I want and kinda know how I will write my code, I don't know where to test it. And can't find it (I don't know if I'm doing the right research tho). I see everyone else just started coding and I'm having a hard time with this part (not making the code, but figuring out where to test it to see if it actually works).

SSethi (WMF) (talkcontribs)

@Itskoda no worries!!

For writing code in Python to show how you can use the MediaWiki API to check if a user is logged or in not or they have the bot right or not, skim through Python basics https://docs.python.org/3/tutorial/ first to understand how you can write a simple script in Python, make a GET Request, use a library and run your code.

This resource might be helpful in understanding how you can use the requests library in Python https://www.pythonforbeginners.com/requests/using-requests-in-python

Then you could look into a simple example on using Python to interact with the MediaWiki API: API:Documentation template#Sample code. And, then write one for the assert module.

Also the empty response code here User:Itskoda/Sandbox/API:Assert#GET Request does not tell why it is empty and what would the output be if the user is not logged in.