buff163_unofficial_api package

Submodules

buff163_unofficial_api.buff163_unofficial_api module

class buff163_unofficial_api.buff163_unofficial_api.Buff163API(hostname: str = 'buff.163.com/api', session_cookie: str = '', ssl_verify: bool = True, logger: Logger = None, page_size: int = 20)[source]

Bases: object

fetch_image_data(item: Item)[source]

Fetches Item icon.

Args:

item (Item): Item from market.

Get entire featured item.

Args:

pageNum (int, optional): Which page number to get. Defaults to 1.

Returns:

List[Item]: List of overview of items.

Get first featured market item (random).

Returns:

Item: Overview of an item.

Page the featured market

Args:

max_amt (int, optional): Amount of Items to get. Defaults to 80.

Returns:

_type_: List of Items

Yields:

Iterator[Item]: List of Items

get_item(item_id: int) SpecificItem[source]

Gets the description/details of an item.

Args:

item_id (int): Specific item’s goods_id.

Returns:

SpecificItem: Specific item.

get_item_market(category: Knife | Gun | Glove | Agent | Sticker | OtherItem, pageNum: int = 1) List[Item][source]

Get specific item’s market page.

Args:

category (enum): the specific category of cs items. pageNum (int, optional): Which page number to get. Defaults to 1.

Returns:

List[Item]: List of overview of items.

buff163_unofficial_api.exceptions module

exception buff163_unofficial_api.exceptions.Buff163Exception[source]

Bases: Exception

buff163_unofficial_api.models module

class buff163_unofficial_api.models.Exterior(category: str, id: int, internal_name: str, localized_name: str)[source]

Bases: object

class buff163_unofficial_api.models.GoodsInfo(icon_url: str, info: Info | dict, original_icon_url: str, steam_price: str, steam_price_cny: str, **kwargs)[source]

Bases: object

class buff163_unofficial_api.models.GoodsInfoItem(can_3_d_inspect: bool, can_display_inspect: bool, can_inspect: bool, can_preview: bool, can_preview_upload: bool, can_search_by_patch: bool, can_search_by_sticker: bool, can_search_by_tournament: bool, can_specific_buy: bool, can_specific_paintwear_buy: bool, icon_url: str, info: Info, item_id: None, normal_icon_url: str, original_icon_url: str, specific: List[Any], specific_paintwear_buying_choices: List[List[str]], steam_price: str, steam_price_cny: str)[source]

Bases: object

class buff163_unofficial_api.models.Info(tags: Tags)[source]

Bases: object

class buff163_unofficial_api.models.Item(buy_max_price: str, buy_num: int, can_bargain: bool, goods_info: GoodsInfo | dict, id: int, market_hash_name: str, market_min_price: int, name: str, quick_price: str, sell_min_price: str, sell_num: int, sell_reference_price: str, short_name: str, steam_market_url: str, transacted_num: int, data: bytes = b'', **kwargs)[source]

Bases: object

save_icon_to(path: str = './', file_name: str = '')[source]
class buff163_unofficial_api.models.ListList(title: str, value: str)[source]

Bases: object

class buff163_unofficial_api.models.PaintseedFilter(name: str, placeholder: str, search: bool, type: str)[source]

Bases: object

class buff163_unofficial_api.models.RelativeGood(goods_id: int, goods_name: str, is_change: bool, sell_min_price: str, sell_num: int, tag: str, tag_name: str)[source]

Bases: object

class buff163_unofficial_api.models.Result(status_code: int, message: str = '', data: List[Dict] = None)[source]

Bases: object

class buff163_unofficial_api.models.ShareData(content: str, thumbnail: str, title: str, url: str)[source]

Bases: object

class buff163_unofficial_api.models.SortByFields(list: List[SortByFieldsList], title: str)[source]

Bases: object

class buff163_unofficial_api.models.SortByFieldsList(attribute: str, default_value: str, list: List[ListList])[source]

Bases: object

class buff163_unofficial_api.models.SpecificItem(allow_bundle_inventory: bool, appid: int, asset_tags: List[Any], asset_tags_buy_order: List[Any], asset_tags_history: List[Any], bookmarked: bool, buy_num: int, can_buy: bool, can_sort_by_heat: bool, container_type: str, containers: List[str], description: None, fade_choices: List[List[int]], game: str, goods_info: GoodsInfoItem, has_buff_price_history: bool, has_bundle_inventory_order: bool, has_fade_name: bool, has_paintwear_rank: bool, has_related: bool, has_rune: bool, id: int, is_container: bool, item_id: None, market_hash_name: str, market_min_price: int, name: str, paintseed_filters: List[PaintseedFilter], paintseed_filters_buy_order: List[Any], paintseed_filters_history: List[Any], paintwear_choices: List[List[str]], paintwear_range: List[str], quick_price: int, rank_types: List[Any], recent_sold_count: int, relative_goods: List[RelativeGood], sell_min_price: str, sell_num: int, sell_reference_price: str, share_data: ShareData, short_name: str, show_game_cms_icon: bool, sort_by_fields: SortByFields, steam_market_url: str, super_short_name: str, support_name_tag: bool, transacted_num: int, user_show_count: int, wiki_link: None, has_rent_order: bool, rent_day_choices: List[int], rent_num: int, rent_sort_by_fields: SortByFields, support_charm: bool, buy_max_price: int = None, buy_min_price_limit: int = None)[source]

Bases: object

class buff163_unofficial_api.models.Tags(exterior: Exterior | dict, quality: Exterior | dict, rarity: Exterior | dict, type: Exterior | dict, weapon: Exterior | dict)[source]

Bases: object

buff163_unofficial_api.rest_adapter module

class buff163_unofficial_api.rest_adapter.RestAdapter(hostname: str = 'buff.163.com/api', session_cookie: str = '', ssl_verify: bool = True, logger: Logger = None)[source]

Bases: object

delete(endpoint: str, ep_params: Dict = None, data: Dict = None) Result[source]

Sends a DELETE request to a specified API endpoint.

Args:

endpoint (str): The endpoint for the POST request. ep_params (Dict, optional): Parameters to include in the request. Defaults to None. data (Dict, optional): Data passed in the request. Defaults to None.

Returns:

Result: status_code, message, data

fetch_data(url: str) bytes[source]

Private method for fetching data from url.

Args:

url (str): Url of fetch request.

Raises:

Buff163Exception: Request failure. Buff163Exception: Status code not valid.

Returns:

bytes: Data in bytes (mainly for images).

get(endpoint: str, ep_params: Dict = None) Result[source]

Sends a GET request to a specified API endpoint.

Args:

endpoint (str): The endpoint for the GET request. ep_params (Dict, optional): Parameters to include in request. Defaults to None.

Returns:

Result: status_code, message, data

post(endpoint: str, ep_params: Dict = None, data: Dict = None) Result[source]

Sends a POST request to a specified API endpoint.

Args:

endpoint (str): The endpoint for the POST request. ep_params (Dict, optional): Parameters to include in the request. Defaults to None. data (Dict, optional): Data passed in the request. Defaults to None.

Returns:

Result: status_code, message, data

Module contents