TibiaWiki API¶
tibiawikisql.api
¶
API to fetch information from TibiaWiki through MediaWiki's API.
Classes:
| Name | Description |
|---|---|
WikiEntry |
Represents a Wiki entry, such as an article or file. |
Article |
Represents a Wiki article. |
Image |
Represents an image info. |
WikiClient |
Contains methods to communicate with TibiaWiki's API. |
WikiEntry
pydantic-model
¶
Bases: BaseModel
Represents a Wiki entry, such as an article or file.
Show JSON schema:
{
"description": "Represents a Wiki entry, such as an article or file.",
"properties": {
"article_id": {
"title": "Article Id",
"type": "integer"
},
"title": {
"title": "Title",
"type": "string"
},
"timestamp": {
"format": "date-time",
"title": "Timestamp",
"type": "string"
}
},
"required": [
"article_id",
"title",
"timestamp"
],
"title": "WikiEntry",
"type": "object"
}
Fields:
Article
pydantic-model
¶
Bases: WikiEntry
Represents a Wiki article.
Show JSON schema:
{
"description": "Represents a Wiki article.",
"properties": {
"article_id": {
"title": "Article Id",
"type": "integer"
},
"title": {
"title": "Title",
"type": "string"
},
"timestamp": {
"format": "date-time",
"title": "Timestamp",
"type": "string"
},
"content": {
"title": "Content",
"type": "string"
}
},
"required": [
"article_id",
"title",
"timestamp",
"content"
],
"title": "Article",
"type": "object"
}
Fields:
Image
pydantic-model
¶
Bases: WikiEntry
Represents an image info.
Show JSON schema:
{
"description": "Represents an image info.",
"properties": {
"article_id": {
"title": "Article Id",
"type": "integer"
},
"title": {
"title": "Title",
"type": "string"
},
"timestamp": {
"format": "date-time",
"title": "Timestamp",
"type": "string"
},
"file_url": {
"title": "File Url",
"type": "string"
}
},
"required": [
"article_id",
"title",
"timestamp",
"file_url"
],
"title": "Image",
"type": "object"
}
Fields:
WikiClient
¶
Contains methods to communicate with TibiaWiki's API.
Methods:
| Name | Description |
|---|---|
get_category_members |
Create a generator that obtains entries in a certain category. |
get_category_members_titles |
Create a generator that obtains a list of article titles in a category. |
get_image_info |
Get an image's info. |
get_images_info |
Get the information of a list of image names. |
get_articles |
Create a generator that obtains a list of articles given their titles. |
get_article |
Get an article's info. |
Source code in tibiawikisql/api.py
get_category_members
¶
Create a generator that obtains entries in a certain category.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The category's name. |
required |
skip_index
|
bool
|
Whether to skip index articles or not. |
True
|
Yields:
| Type | Description |
|---|---|
Generator[WikiEntry]
|
Articles in this category. |
Source code in tibiawikisql/api.py
get_category_members_titles
¶
Create a generator that obtains a list of article titles in a category.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The category's name. |
required |
skip_index
|
bool
|
Whether to skip index articles or not. |
True
|
Yields:
| Type | Description |
|---|---|
Generator[str]
|
Titles of articles in this category. |
Source code in tibiawikisql/api.py
get_image_info
¶
get_images_info
¶
Get the information of a list of image names.
It is not required to prefix the name with File:, but the extension is required.
Warning
The order of the returned images might not match the order of the provided names due to an API limitation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
names
|
list[str]
|
A list of names of images to get the info of. |
required |
Yields:
| Type | Description |
|---|---|
Generator[Image | None]
|
An image's information. |
Source code in tibiawikisql/api.py
get_articles
¶
Create a generator that obtains a list of articles given their titles.
Warning
The order of the returned articles might not match the order of the provided names due to an API limitation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
names
|
list[str]
|
A list of names of articles to get the info of. |
required |
Yields:
| Type | Description |
|---|---|
Generator[Article | None]
|
An article in the list of names. |