logentries module#
Objects representing MediaWiki log entries.
- class logentries.BlockEntry(apidata, site)[source]#
Bases:
LogEntryBlock or unblock log entry.
It might contain a block or unblock depending on the action. The duration, expiry and flags are not available on unblock log entries.
- Parameters:
apidata (dict[str, Any])
site (pywikibot.site.BaseSite)
- duration()[source]#
Return a datetime.timedelta representing the block duration.
- Returns:
datetime.timedelta, or None if block is indefinite.
- Return type:
timedelta | None
- expiry()[source]#
Return a Timestamp representing the block expiry date.
- Return type:
Timestamp | None
- class logentries.LogEntry(apidata, site)[source]#
Bases:
UserDictGeneric log entry.
LogEntry parameters may be retrieved by the corresponding method or the LogEntry key. The following statements are equivalent:
action = logentry.action() action = logentry[‘action’] action = logentry.data[‘action’]
Initialize object from a logevent dict returned by MW API.
- Parameters:
apidata (dict[str, Any])
site (pywikibot.site.BaseSite)
- page()[source]#
Page on which action was performed.
- Returns:
page on action was performed
- Return type:
int | Page
- property params: dict[str, Any]#
Additional data for some log entry types.
Added in version 9.4: private _param attribute became a public property
- class logentries.LogEntryFactory(site, logtype=None)[source]#
Bases:
objectLogEntry Factory.
Only available method is create()
- Parameters:
site (pywikibot.site.BaseSite) – The site on which the log entries are created.
logtype (str | None) – The log type of the log entries, if known in advance. If None, the Factory will fetch the log entry from the data to create each object.
- create(logdata)[source]#
Instantiate the LogEntry object representing logdata.
- Parameters:
logdata (dict[str, Any]) – <item> returned by the api
- Returns:
LogEntry object representing logdata
- Return type:
- classmethod get_entry_class(logtype)[source]#
Return the class corresponding to the @logtype string parameter.
- Returns:
specified subclass of LogEntry
- Parameters:
logtype (str)
- Return type:
Note
this class method cannot verify whether the given logtype already exits for a given site; to verify use Site.logtypes or use the get_valid_entry_class instance method instead.
- class logentries.MoveEntry(apidata, site)[source]#
Bases:
LogEntryMove log entry.
Initialize object from a logevent dict returned by MW API.
- Parameters:
apidata (dict[str, Any])
site (pywikibot.site.BaseSite)
- suppressedredirect()[source]#
Return True if no redirect was created during the move.
- Return type:
bool
- property target_title: str#
Return the target title.
- class logentries.OtherLogEntry(apidata, site)[source]#
Bases:
LogEntryA log entry class for unspecified log events.
Initialize object from a logevent dict returned by MW API.
- Parameters:
apidata (dict[str, Any])
site (pywikibot.site.BaseSite)
- class logentries.PatrolEntry(apidata, site)[source]#
Bases:
LogEntryPatrol log entry.
Initialize object from a logevent dict returned by MW API.
- Parameters:
apidata (dict[str, Any])
site (pywikibot.site.BaseSite)
- property auto: bool#
Return auto patrolled.
- property current_id: int#
Return the current id.
- property previous_id: int#
Return the previous id.
- class logentries.RightsEntry(apidata, site)[source]#
Bases:
LogEntryRights log entry.
Initialize object from a logevent dict returned by MW API.
- Parameters:
apidata (dict[str, Any])
site (pywikibot.site.BaseSite)
- class logentries.UploadEntry(apidata, site)[source]#
Bases:
LogEntryUpload log entry.
Initialize object from a logevent dict returned by MW API.
- Parameters:
apidata (dict[str, Any])
site (pywikibot.site.BaseSite)