Skip to content

Instantly share code, notes, and snippets.

@halfak
Created May 11, 2020 21:21
Show Gist options
  • Save halfak/a497ea370eabc93a66428e7b78996435 to your computer and use it in GitHub Desktop.
Save halfak/a497ea370eabc93a66428e7b78996435 to your computer and use it in GitHub Desktop.
$ python
Python 3.5.1+ (default, Mar 30 2016, 22:46:26)
[GCC 5.3.1 20160330] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> import mwapi
>>> session = mwapi.Session("https://deployment.wikimedia.beta.wmflabs.org/")
Sending requests with default User-Agent. Set 'user_agent' on mwapi.Session to quiet this message.
>>> session.get(action='query', meta="tokens", format="json")
{'query': {'tokens': {'csrftoken': '+\\'}}, 'batchcomplete': ''}
>>> session.post(action='jadeproposeorendorse', title='Jade:Diff/123', facet='editquality', labeldata='{"damaging": false, "goodfaith": true}', notes="test", endorsementorigin="foo", token='+\\')
{'data': {'facets': {'editquality': {'proposals': [{'endorsements': [{'comment': 'As proposer', 'created': '2020-05-11T21:20:31+00:00', 'origin': 'foo', 'touched': '2020-05-11T21:20:31+00:00', 'author': {'ip': '73.94.56.86'}}], 'preferred': '', 'author': {'ip': '73.94.56.86'}, 'labeldata': {'goodfaith': ''}, 'notes': 'test'}]}}}}
@halfak
Copy link
Author

halfak commented May 11, 2020

>>> session2.post(action='jadeproposeorendorse', title='Jade:Diff/1234', facet='editquality', labeldata='{"damaging": false, "goodfaith": true}', notes="test", endorsementorigin="foo", token='+\\')
{'data': {'facets': {'editquality': {'proposals': [{'endorsements': [{'comment': 'As proposer', 'created': '2020-05-11T21:22:51+00:00', 'origin': 'foo', 'touched': '2020-05-11T21:22:51+00:00', 'author': {'ip': '73.94.56.86'}}], 'preferred': '', 'author': {'ip': '73.94.56.86'}, 'labeldata': {'goodfaith': ''}, 'notes': 'test'}]}}}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment