reqMediaWiki {wikiTools}R Documentation

Uses httr package to retrieve responses using the MediaWiki API.

Description

For MediaWiki requests only user_agent is necessary in the request headers. See https://www.mediawiki.org/wiki/API:Etiquette. The standard and default output format in MediaWiki is JSON. All other formats are discouraged. The output format should always be specified using the request param "format" in the "query" request. See https://www.mediawiki.org/wiki/API:Data_formats#Output.

Usage

reqMediaWiki(query, project = "en.wikipedia.org", method = "GET", attempts = 2)

Arguments

query

A list with de (key, values) pairs with the search. Note that if titles are included in the query, the MediaWiki API has a limit of 50 titles en each query. In that case a error response is achieved.

project

The Wikimedia project to search. Default en.wikipedia.org.

method

The method used in the httr request. Default 'GET'. Note in "https://www.mediawiki.org/wiki/API:Etiquette#Request_limit": "Whenever you're reading data from the web service API, you should try to use GET requests if possible, not POST, as the latter are not cacheable."

attempts

On ratelimit errors, the number of times the request is retried using a 60 seconds interval between retries. Default 2. If 0 no retries are done.

Value

The response in JSON format or NULL on errors.

Author(s)

Angel Zazo, Department of Computer Science and Automatics, University of Salamanca


[Package wikiTools version 1.2.4 Index]