csbluegem package
csbluegem.client module
- class csbluegem.client.Client(session=None)[source]
Bases:
objectA CSBlueGem Client.
- async with x:
Returns the Client itself. Used to gracefully close the client on exit.
async with csbluegem.Client() as client: ...
- async search(skin, /, currency=Currency.USD, type=None, pattern=None, price_min=None, price_max=None, wear_min=None, wear_max=None, sort=SortKey.Date, order=Order.Desc, origin=None, date_min=None, date_max=None, limit=None, offset=None, pattern_data=False, filters=None)[source]
This function is a coroutine.
Searches for an item on CSBlueGem.
- Parameters:
item (
Item) – The item to search for.currency (
Currency, optional) – The currency to return, by default USD.type (Optional[
ItemType], optional) – The item’s type, None for any. By default None.pattern (Optional[
int], optional) – The items pattern. None for any pattern. By default None.price_min (Optional[
float], optional) – The minimum price of the sale.price_max (Optional[
float], optional) – The maximum price of the sale.wear_min (Optional[
float], optional) – The minimum float of a returned item.wear_max (Optional[
float], optional) – The maximum float of a returned item.sort (
SortKey, optional) – How should the results be sorted, by default Date.order (
Order, optional) – How to order the results, by default DESC.origin (Optional[
Origin], optional) – Where the sales originated from, None for any. By default None.date_min (Optional[
datetime.datetime], optional) – The earliest a sale can be from, None for no minimum, by default None.date_max (Optional[
datetime.datetime], optional) – The latest a sale can be from, None for no maximum, by default None.limit (Optional[
int], optional) – The maximum number of results to return. None for no limit. By default None.offset (Optional[
int], optional) – The offset to start returning results from. None for no offset. By default None.pattern_data (
bool, optional) – Whether to include pattern data in the returned results, by default Falsefilters (
Filter) – Filters to apply to the search.
- Returns:
The returned sales.
- Return type:
List[
Sale]- Raises:
BadArgument – You provided an invalid parameter.
InvalidRequest – One of the parameters given was invalid.
ServerError – The CSBlueGem server could not process the request.
NotFound – The search returned no results.
- async pattern_data(item, /, pattern=None, sort=SortKey.Pattern, order=Order.Desc, quantity=False, offset=None, limit=None, filters=None)[source]
This function is a coroutine.
Get pattern data for a skin.
- Parameters:
item (
Item) – The item to get pattern data for.pattern (Optional[
int], optional) – The pattern to get data for, None for any. By default Nonesort (
SortKey, optional) – How the results should be sorted, by default pattern.order (
Order, optional) – How to order the results, by default descending.quantity (
bool, optional) – Whether to return quantities of sales. By default False.offset (Optional[
int], optional) – The offset to start returning results from. None for no offset. By default None.limit (Optional[
int], optional) – The maximum number of results to return, None for no limit. By default None.
- Returns:
The resulting data about the patterns.
- Return type:
List[
PatternData]- Raises:
BadArgument – You provided an invalid parameter.
InvalidRequest – One of the parameters given was invalid.
ServerError – The CSBlueGem server could not process the request.
NotFound – The search returned no results.
- async pricecheck(item, pattern, wear)[source]
This function is a coroutine.
Runs a price check for an item.
- Parameters:
- Returns:
The price check value, in USD.
- Return type:
- Raises:
BadArgument – You provided an invalid argument.
InvalidRequest – One of the parameters given was invalid.
ServerError – The CSBlueGem server could not process the request.
NotFound – The search returned no results.
csbluegem.types module
- class csbluegem.types.Screenshots(_inspect, inspect_playside, inspect_backside)[source]
Bases:
objectScreenshots for a
Sale.- inspect
A url to an inspect link. Always returns a url for an inspect link.
This will be None if no inspect links are available.
For CSFloat based sales, this returns the playside inspect link.
- Type:
Optional[
str]
- inspect_playside
A url to the playside inspect link. Only applicable for CSFloat sales.
- Type:
Optional[
str]
- class csbluegem.types.PatternDataScreenshots(csbluegem_screenshot, aq_oiled)[source]
Bases:
objectScreenshots that may be associated with this
PatternData.Only available when using
pattern_data().
- class csbluegem.types.PatternDataExtra(similar_playside, similar_backside, csfloat_link, search)[source]
Bases:
objectExtra information provided for pattern data.
Only available when using
pattern_data().
- class csbluegem.types.PatternData(backside_blue, backside_contour_blue, backside_contour_purple, backside_gold, backside_purple, playside_blue, playside_contour_blue, playside_contour_purple, playside_gold, playside_purple, pattern, quantity, screenshots, extra)[source]
Bases:
objectData for a pattern on CSBlueGem.
- backside_contour_purple
The number of individual purple sections visible on the back side.
- Type:
- playside_contour_purple
The number of individual purple sections visible on the play side.
- Type:
- screenshots
Example screenshots of the pattern associated with this PatternData on in game items.
- Type:
Optional[
PatternDataScreenshots]
- extra
Extra information about this PatternData.
- Type:
Optional[
PatternDataExtra]
- class csbluegem.types.Sale(buff_id, csfloat, wear, type, pattern, price, timestamp, steam_inspect_link, origin, pattern_data, screenshots)[source]
Bases:
objectRepresents a record of sale from CSBlueGem
- timestamp
When the sale occurred.
- Type:
- pattern_data
The pattern data for the item, if available.
- Type:
Optional[
PatternData]
- screenshots
Screenshot data for the item.
- Type:
- property float
The float of the item.
- property date
The date this item was sold.
- property epoch
The epoch the item was sold.
- property days_since
Returns the number of days since this Sale.
- property is_stattrak
Whether the item was stattrak
- class csbluegem.types.SearchResponse(meta, sales)[source]
Bases:
objectRepresents a response to a search query.
- meta
Metadata about the query.
- Type:
- class csbluegem.types.PatternDataResponse(meta, pattern_data)[source]
Bases:
objectRepresents a response to a pattern data query.
- meta
Metadata about the query.
- Type:
- data
The pattern datas that were returned.
- Type:
List[
PatternData]
- class csbluegem.types.Origin[source]
Where a
Saleoriginated from.- Buff
Buff.163.com
- CSFloat
CSFloat.com
- SkinBid
SkinBid.com
- BroSkins
BroSkins.com
- Skinport
Skinport.com
- C5Game
c5game.com
- class csbluegem.types.FilterType[source]
What a
Filtershould filter by.- PlaysideBlue
The amount of blue on the play side of the item.
- PlaysidePurple
The amount of purple on the play side of the item.
- PlaysideGold
The amount of gold on the play side of the item.
- BacksideBlue
The amount of blue on the back side of the item.
- BacksidePurple
The amount of purple on the back side of the item.
- BacksideGold
The amount of gold on the back side of the item.
- class csbluegem.types.Filter(type, min, max)[source]
Bases:
objectA filter for searches.
- type
What kind of filter.
- Type:
- class csbluegem.types.Order[source]
How results from the API should be ordered.
- Asc
Sort in ascending order.
- Desc
Sort in descending order.
- class csbluegem.types.ItemType[source]
The type of an item.
- StatTrak
A StatTrak item.
- Normal
A non StatTrak item.
- class csbluegem.types.Currency[source]
Available currencies for use in the API.”
- USD
United States Dollar
- EUR
Euros
- JPY
- Japanese Yen
- GBP
- Great British Pound
- CNY
- Chinese Yuan
- AUD
- Australian Dollar
- CAD
- Canadian Dollar
- class csbluegem.types.SortKey[source]
How the results of a query should be sorted.
- PlaysideBlue
The amount of blue on the play side.
- PlaysidePurple
The amount of purple on the play side.
- PlaysideGold
The amount of gold on the play side.
- BacksideBlue
The amount of blue on the back side.
- BacksidePurple
The amount of purple on the back side.
- BacksideGold
The amount of gold on the back side.
- PlaysideContourBlue
The number of blue regions on the play side.
- PlaysideContourPurple
The number of purple regions on the play side.
- BacksideContourBlue
The number of blue regions on the back side.
- BacksideContourPurple
The number of purple regions on the back side.
- PatternData
The pattern of the item.
- Float
The float of the item.
- Date
The date of the sale.
- Price
The price of the sale.
- class csbluegem.types.Item[source]
Items that can be queried from the API.
- AK47
AK-47
- Bayonet
Bayonet Knife
- BowieKnife
Bowie Knife
- ButterflyKnife
Butterfly Knife
- ClassicKnife
Classic Knife
- DesertEagle_Heat_Treated
Desert Eagle Heat Treated
- FalchionKnife
Falchion Knife
- FiveSeveN
Five-SeveN
- FiveSeveN_Heat_Treated
Five-SeveN Heat Treated
- FlipKnife
Flip Knife
- GutKnife
Gut Knife
- HuntsmanKnife
Huntsman Knife
- HydraGloves
Hydra Gloves
- Karambit
Karambit Knife
- KukriKnife
Kukri Knife
- M9Bayonet
M9 Bayonet Knife
- MAC10
MAC-10
Navaja Knife
- NomadKnife
Nomad Knife
- ParacordKnife
Paracord Knife
- ShadowDaggers
Shadow Daggers
- SkeletonKnife
Skeleton Knife
- StilettoKnife
Stiletto Knife
- SurvivalKnife
Survival Knife
- TalonKnife
Talon Knife
- UrsusKnife
Ursus Knife
csbluegem.utils module
- csbluegem.utils.utcnow()[source]
Returns an aware UTC datetime representing the current time.
- Returns:
The current aware datetime in UTC.
- Return type:
- csbluegem.utils.as_chunks(iterable, n)[source]
Batches an iterable into chunks of up to size n.
- Parameters:
iterable (
collections.abc.Iterable) – The iterable to batchn (
int) – The number of elements per generated tuple.
- Raises:
ValueError – At least one result must be returned per group.
- csbluegem.utils.safe_get(dict_, *keys)[source]
Safely get a nested key from a dictionary.
ex.
d = { 'i': 1, 'j': { 'k': '2' } } safe_get(d, 'i') # -> 1 safe_get(d, 'j', 'k') # -> '2'
- Parameters:
dict (Dict[Any, Any]) – The dictionary to get the key from
keys (Any) – The keys to get from the dictionary. Processed in order.
- Returns:
The value at the key. None if the key could not be gotten.
- Return type:
Optional[Any]
csbluegem.errors module
- class csbluegem.errors.BadArgument[source]
Bases:
BlueGemError
- class csbluegem.errors.HTTPException(code, message='')[source]
Bases:
BlueGemError
- class csbluegem.errors.NotFound(code, message='')[source]
Bases:
HTTPException
- class csbluegem.errors.ServerError(code, message='')[source]
Bases:
HTTPException
- class csbluegem.errors.InvalidRequest(code, message='')[source]
Bases:
HTTPException