bdomarket.utils
¶
Boss
¶
GetTimer()
¶
Get the scraped boss timer data.
Returns:
Name | Type | Description |
---|---|---|
list |
list
|
A list of lists containing the boss timer data, where each sublist contains the time and the bosses. |
GetTimerJSON(indent=2)
¶
Convert the boss timer data to a JSON string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indent
|
int
|
Number of spaces for JSON indentation. Defaults to 2. |
2
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
JSON string of the boss timer data. |
Item
¶
GetIcon(folderpath='icons', isrelative=True, filenameprop=ItemProp.ID)
¶
Download and save the item’s icon to a specified folder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
folderpath
|
str
|
Path to save the icon. Defaults to "icons". |
'icons'
|
isrelative
|
bool
|
If True, folderpath is relative to the current file. If False, it’s absolute. Defaults to True. |
True
|
filenameprop
|
ItemProp
|
Use item’s ID or name for the filename. Defaults to ItemProp.ID. |
ID
|
__init__(id='735008', name='')
¶
Initialize an Item object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
Unique identifier for the item. Defaults to "735008". |
'735008'
|
name
|
str
|
Name of the item. Defaults to "". |
''
|
__repr__()
¶
Representation of the Item object.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
String representation with id, name, and sid. |
__str__()
¶
String representation of the Item object.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Descriptive string with name, id, and sid. |
to_dict()
¶
Convert the item to a dictionary.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Dictionary with item’s id, name, sid, and grade. |
Pig
¶
__init__(region=PigCave.EU)
¶
get_status()
async
¶
Fetch Pig Cave status (garmoth data).
Returns:
Name | Type | Description |
---|---|---|
ApiResponse |
ApiResponse
|
Contains success status, status code, message, and response content. |
Raises:
Type | Description |
---|---|
ClientError
|
If the HTTP request fails. |
check_for_updates()
¶
Check if a package has an update available on PyPI.
datetime_to_timestamp(dt)
¶
Convert a datetime object to a Unix timestamp.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dt
|
datetime
|
Datetime object. |
required |
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
Unix timestamp. |
get_items_by_id_from_db(db, id=0)
¶
Retrieve items from a database by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
db
|
str
|
Database containing items with 'id' keys. |
required |
id
|
int
|
ID to search for. Defaults to 0. |
0
|
Returns:
Name | Type | Description |
---|---|---|
list |
list
|
List of items matching the given ID. |
get_items_by_name_from_db(db, name='')
¶
Retrieve items from a database by name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
db
|
str
|
Database containing items with 'name' keys. |
required |
name
|
str
|
Name to search for. Defaults to "". |
''
|
Returns:
Name | Type | Description |
---|---|---|
list |
list
|
List of items matching the given name. |
search_items_by_id(file_path, search_id)
¶
Search items by ID in a JSON file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path
|
str
|
Path to the JSON file. |
required |
search_id
|
int
|
ID to search for. |
required |
Returns:
Name | Type | Description |
---|---|---|
list |
list
|
List of items with the specified ID. |
search_items_by_name(file_path, search_string)
¶
Search items by name in a JSON file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path
|
str
|
Path to the JSON file. |
required |
search_string
|
str
|
String to search in item names. |
required |
Returns:
Name | Type | Description |
---|---|---|
list |
list
|
List of items with names containing the search string (case-insensitive). |
timestamp_to_datetime(timestamp)
¶
Convert a timestamp to a UTC datetime object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timestamp
|
float
|
Unix timestamp. |
required |
Returns:
Name | Type | Description |
---|---|---|
datetime |
datetime
|
Datetime object in UTC timezone. |