Clientlogin#

class wikibaseintegrator.wbi_login.Clientlogin(user=None, password=None, mediawiki_api_url=None, token_renew_period=1800, user_agent=None, **kwargs)[source]#

Bases: _Login

This class is used to log in with a user account

Parameters:
  • user (str | None, default: None) – The username

  • password (str | None, default: None) – The password

  • mediawiki_api_url (str | None, default: None) – The URL to the MediaWiki API (default Wikidata)

  • token_renew_period (int, default: 1800) – Seconds after which a new token should be requested from the Wikidata server

  • user_agent (str | None, default: None) – UA string to use for API requests.

  • kwargs (Any) – Additional parameters to pass to the requests.sessions.Session.post method, such as headers or proxies.

generate_edit_credentials()#

Request an edit token and update the cookie_jar in order to add the session cookie

Return type:

RequestsCookieJar

Returns:

Returns a json with all relevant cookies, aka cookie jar

Can be called in order to retrieve the cookies from an instance of wbi_login.Login

Return type:

RequestsCookieJar

Returns:

Returns a json with all relevant cookies, aka cookie jar

get_edit_token()#

Can be called in order to retrieve the edit token from an instance of wbi_login.Login

Return type:

str | None

Returns:

returns the edit token

get_session()#

Returns the requests.Session object used for the login.

Return type:

Session

Returns:

Object of type requests.Session()

reauthenticate()[source]#

Redo the full clientlogin flow on the existing session, then refresh the CSRF token. See _Login.reauthenticate() for why this full re-login is needed instead of just fetching a new token.

Return type:

None