louisa-uno / dmarket_bot

This repository is an english translation of https://github.com/timagr615/dmarket_bot
14 stars 2 forks source link

History cannot get LastSales for items with apostrophes #14

Open Cfomodz opened 9 months ago

Cfomodz commented 9 months ago

image

2024-01-22 20:51:50.377 | DEBUG    | modules.skinbase:filter_skins:63 - Game: Games.RUST. Get history for Black Beenie Hat
2024-01-22 20:51:50.377 | DEBUG    | api.dmarketapi:generate_headers:32 - string_to_sign: GET/trade-aggregator/v1/last-sales?gameId=rust&title=Black+Beenie+Hat
2024-01-22 20:51:50.515 | DEBUG    | modules.skinbase:filter_skins:72 - Avg price: 0.07
2024-01-22 20:51:50.515 | DEBUG    | modules.skinbase:filter_skins:63 - Game: Games.RUST. Get history for Black Hoodie
2024-01-22 20:51:50.516 | DEBUG    | api.dmarketapi:generate_headers:32 - string_to_sign: GET/trade-aggregator/v1/last-sales?gameId=rust&title=Black+Hoodie
2024-01-22 20:51:50.653 | DEBUG    | modules.skinbase:filter_skins:72 - Avg price: 0.25
2024-01-22 20:51:50.654 | DEBUG    | modules.skinbase:filter_skins:63 - Game: Games.RUST. Get history for Black Mamba
2024-01-22 20:51:50.654 | DEBUG    | api.dmarketapi:generate_headers:32 - string_to_sign: GET/trade-aggregator/v1/last-sales?gameId=rust&title=Black+Mamba
2024-01-22 20:51:50.815 | DEBUG    | modules.skinbase:filter_skins:63 - Game: Games.RUST. Get history for Blacksmith's Door
2024-01-22 20:51:50.816 | DEBUG    | api.dmarketapi:generate_headers:32 - string_to_sign: GET/trade-aggregator/v1/last-sales?gameId=rust&title=Blacksmith%27s+Door
2024-01-22 20:51:50.986 | ERROR    | modules.skinbase:filter_skins:89 - Exception in skinbasecan only concatenate str (not "type") to str
2024-01-22 20:51:50.986 | ERROR    | modules.skinbase:filter_skins:89 - Exception in skinbasecan only concatenate str (not "type") to str
2024-01-22 20:51:50.987 | DEBUG    | modules.skinbase:filter_skins:63 - Game: Games.RUST. Get history for Blacksmith's Hatchet
2024-01-22 20:51:50.988 | DEBUG    | api.dmarketapi:generate_headers:32 - string_to_sign: GET/trade-aggregator/v1/last-sales?gameId=rust&title=Blacksmith%27s+Hatchet
2024-01-22 20:51:51.156 | ERROR    | modules.skinbase:filter_skins:89 - Exception in skinbasecan only concatenate str (not "type") to str
2024-01-22 20:51:51.156 | ERROR    | modules.skinbase:filter_skins:89 - Exception in skinbasecan only concatenate str (not "type") to str

Testing tens of thousands of items and this is the only error among them (as far as history is concerned)

PS The skin DB takes around 1 min per 1k offers you pull from Dmarket, so don't be surprised when the DB takes an hour to create the base the first time if you don't minimize the config params to optimize for testing (a span of a few cents usually does fine).

ballkicker18 commented 9 months ago

Just add this to string_to_sign in generate_headers() - str(furl(string_to_sign).add(params)).replace("%27", "'").replace("%28", "(").replace("%29", ")"). As I understand it, the characters ' () should not be replaced in the signature line.