-
Notifications
You must be signed in to change notification settings - Fork 78
Request actions
Steve edited this page Jan 20, 2018
·
30 revisions
Getting data in wptools centers on request "actions". We make API requests to get data, and then we assign values from the data to select data members. Most actions map to a get_{action}
method. All request actions are cached to prevent requests for the same data.
Action | Method | Description |
---|---|---|
* | get() | some mix of all actions below |
imageinfo | get_imageinfo() | Mediawiki API:Imageinfo request for image info |
labels | get_labels() | Wikidata:API action=wbgetentities request for entity labels |
parse | get_parse() | MediaWiki:API action=parse request for parsetree/infobox data |
query | get_query() | MediaWiki:API action=query request for extracts, image, etc. |
querymore | get_more() | MediaWiki:API action=query request for files, categories, views, etc. |
random | get_random() | Mediawiki API:Random for random page |
restbase | get_restbase() | RESTBase /page/ requests for page content |
wikidata | get_wikidata() | Wikidata:API action=wbgetentities for page wikidata |
page.cache
{
imageinfo: {query, response, info},
labels: {query, response, info},
parse: {query, response, info},
query: {query, response, info},
querymore: {query, response, info},
restbase: {query, response, info},
wikidata: {query, response, info}
}
Action | Method | Description |
---|---|---|
categorymembers | get_members() | Mediawiki API:Categorymembers for category members |
random:14 | get_random() | Mediawiki API:Random for random category (ns=14) |
category.cache
{
category: {query, response, info},
category: {query, response, info},
}
Action | Method | Description |
---|---|---|
siteinfo | get_info() | Mediawiki API:Siteinfo and Extension:PageViewInfo for site info |
sitematrix | get_sites() | Wikimedia Commons Extension:SiteMatrix for sitematrix and a randomly selected site |
sitevisitors | get_info() | Mediawiki Extension:PageViewInfo for sitewide unique visitors |
site.cache
{
siteinfo: {query, response, info},
sitematrix: {query, response, info},
sitevisitors: {query, response, info}
}
The wptools
user-agent will look like this:
wptools/<version> (https://github.com/siznax/wptools) <libs>