wikibaseintegrator.entities.mediainfo
- class wikibaseintegrator.entities.mediainfo.MediaInfoEntity(labels=None, descriptions=None, aliases=None, **kwargs)[source]
Bases:
BaseEntity
- Parameters:
labels (Labels | None)
descriptions (Descriptions | None)
aliases (Aliases | None)
kwargs (Any)
- ETYPE = 'mediainfo'
- __init__(labels=None, descriptions=None, aliases=None, **kwargs)[source]
- Parameters:
api
labels (
Labels
|None
)descriptions (
Descriptions
|None
)aliases (
Aliases
|None
)sitelinks
kwargs (
Any
)
- Return type:
None
- add_claims(claims, action_if_exists=ActionIfExists.APPEND_OR_REPLACE)
- Parameters:
claims (
Claim
|list
[Claim
] |Claims
) – A Claim, list of Claim or just a Claims object to add to this Claims object.action_if_exists (
ActionIfExists
) – Replace or append the statement. You can force an addition if the declaration already exists. KEEP: The original claim will be kept and the new one will not be added (because there is already one with this property number) APPEND_OR_REPLACE: The new claim will be added only if the new one is different (by comparing values) FORCE_APPEND: The new claim will be added even if already exists REPLACE_ALL: The new claim will replace the old one
- Return type:
- Returns:
Return the updated entity object.
- property api: WikibaseIntegrator
- clear(**kwargs)
Use the clear parameter of wbeditentity API call to clear the content of the entity. The entity will be updated with an empty dictionary.
- Parameters:
kwargs (
Any
) – More arguments for _write() and Python requests- Return type:
dict
[str
,Any
]- Returns:
A dictionary representation of the edited Entity
- delete(login=None, allow_anonymous=False, is_bot=None, **kwargs)
Delete the current entity. Use the pageid first if available and fallback to the page title.
- Parameters:
login (
_Login
|None
) – A wbi_login.Login instanceallow_anonymous (
bool
) – Allow an unidentified edit to the MediaWiki API (default False)is_bot (
bool
|None
) – Flag the edit as a botreason – Reason for the deletion. If not set, an automatically generated reason will be used.
deletetalk – Delete the talk page, if it exists.
kwargs (
Any
) – Any additional keyword arguments to pass to mediawiki_api_call_helper and requests.request
- Returns:
The data returned by the API as a dictionary
- property descriptions: Descriptions
- download_entity_ttl(**kwargs)
- Return type:
str
- from_json(json_data)[source]
Import a dictionary into BaseEntity attributes.
- Parameters:
json_data (
dict
[str
,Any
]) – A specific dictionary from MediaWiki API- Return type:
- Returns:
- get_by_title(titles, sites='commonswiki', **kwargs)[source]
- Return type:
- Parameters:
titles (list[str] | str)
sites (str)
kwargs (Any)
- get_entity_url(wikibase_url=None)
- Return type:
str
- Parameters:
wikibase_url (str | None)
- get_json()[source]
To get the dict equivalent of the JSON representation of the entity.
- Return type:
dict
[str
,str
|dict
]- Returns:
- property id: str | None
- property lastrevid: int | None
- property pageid: str | int | None
- property title: str | None
- property type: str
- write(**kwargs)[source]
Write the MediaInfoEntity data to the Wikibase instance and return the MediaInfoEntity object returned by the instance.
- Parameters:
data – The serialized object that is used as the data source. A newly created entity will be assigned an ‘id’.
summary – A summary of the edit
login – A login instance
allow_anonymous – Force a check if the query can be anonymous or not
clear – Clear the existing entity before updating
is_bot – Add the bot flag to the query
kwargs (
Any
) – More arguments for Python requests
- Return type:
- Returns:
an MediaInfoEntity of the response from the instance
- write_required(base_filter=None, action_if_exists=ActionIfExists.REPLACE_ALL, **kwargs)
- Return type:
bool
- Parameters:
base_filter (list[BaseDataType | list[BaseDataType]] | None)
action_if_exists (ActionIfExists)
kwargs (Any)