API:Logout

From MediaWiki.org
Jump to navigation Jump to search

Other languages:
Deutsch • ‎English • ‎Nederlands • ‎català • ‎dansk • ‎español • ‎français • ‎italiano • ‎lingála • ‎polski • ‎português • ‎português do Brasil • ‎română • ‎русский • ‎العربية • ‎ไทย • ‎中文 • ‎日本語 • ‎한국어
MediaWiki version: 1.12

GET request to log out of account.

Logging out deletes the log in tokens and other browser cookies.

API documentation[edit]




action=logout

(main | logout)

Log out and clear session data.

Example:
Log the current user out.
api.php?action=logout [open in sandbox]

Example[edit]

GET Request[edit]

Log out of account and clear session data.

Response[edit]

{

}

Sample code[edit]

logout.py

#!/usr/bin/python3

"""
    logout.py

    MediaWiki Action API Code Samples
    Demo of `Logout` module: Log out and clear session data
    MIT license
"""

import requests

S = requests.Session()

URL = "https://en.wikipedia.org/w/api.php"

PARAMS = {
    'action':"logout",
    'format':"json"
}

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

print(DATA)

See also[edit]