whitemarket-sdk 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (348) hide show
  1. whitemarket_sdk-0.1.0/.gitignore +37 -0
  2. whitemarket_sdk-0.1.0/CHANGELOG.md +123 -0
  3. whitemarket_sdk-0.1.0/LICENSE +21 -0
  4. whitemarket_sdk-0.1.0/PKG-INFO +464 -0
  5. whitemarket_sdk-0.1.0/README.md +405 -0
  6. whitemarket_sdk-0.1.0/pyproject.toml +193 -0
  7. whitemarket_sdk-0.1.0/src/whitemarket/__init__.py +45 -0
  8. whitemarket_sdk-0.1.0/src/whitemarket/_async/__init__.py +1 -0
  9. whitemarket_sdk-0.1.0/src/whitemarket/_async/buying.py +263 -0
  10. whitemarket_sdk-0.1.0/src/whitemarket/_async/client.py +278 -0
  11. whitemarket_sdk-0.1.0/src/whitemarket/_async/credentials.py +89 -0
  12. whitemarket_sdk-0.1.0/src/whitemarket/_async/deal_lookup.py +30 -0
  13. whitemarket_sdk-0.1.0/src/whitemarket/_async/deals.py +411 -0
  14. whitemarket_sdk-0.1.0/src/whitemarket/_async/executor.py +25 -0
  15. whitemarket_sdk-0.1.0/src/whitemarket/_async/export_cache.py +30 -0
  16. whitemarket_sdk-0.1.0/src/whitemarket/_async/export_stream.py +59 -0
  17. whitemarket_sdk-0.1.0/src/whitemarket/_async/export_transport.py +345 -0
  18. whitemarket_sdk-0.1.0/src/whitemarket/_async/exports.py +252 -0
  19. whitemarket_sdk-0.1.0/src/whitemarket/_async/graphql.py +122 -0
  20. whitemarket_sdk-0.1.0/src/whitemarket/_async/graphql_base.py +53 -0
  21. whitemarket_sdk-0.1.0/src/whitemarket/_async/http_reply.py +55 -0
  22. whitemarket_sdk-0.1.0/src/whitemarket/_async/inventory.py +73 -0
  23. whitemarket_sdk-0.1.0/src/whitemarket/_async/market.py +88 -0
  24. whitemarket_sdk-0.1.0/src/whitemarket/_async/pagination.py +53 -0
  25. whitemarket_sdk-0.1.0/src/whitemarket/_async/partner_token.py +121 -0
  26. whitemarket_sdk-0.1.0/src/whitemarket/_async/profile.py +133 -0
  27. whitemarket_sdk-0.1.0/src/whitemarket/_async/seams.py +36 -0
  28. whitemarket_sdk-0.1.0/src/whitemarket/_async/selling.py +298 -0
  29. whitemarket_sdk-0.1.0/src/whitemarket/_async/store.py +34 -0
  30. whitemarket_sdk-0.1.0/src/whitemarket/_async/tokens.py +66 -0
  31. whitemarket_sdk-0.1.0/src/whitemarket/_async/transport.py +237 -0
  32. whitemarket_sdk-0.1.0/src/whitemarket/_async/wallet.py +174 -0
  33. whitemarket_sdk-0.1.0/src/whitemarket/_concurrency.py +153 -0
  34. whitemarket_sdk-0.1.0/src/whitemarket/_generated/__init__.py +1838 -0
  35. whitemarket_sdk-0.1.0/src/whitemarket/_generated/async_base_client.py +14 -0
  36. whitemarket_sdk-0.1.0/src/whitemarket/_generated/auth_steam_jwt.py +15 -0
  37. whitemarket_sdk-0.1.0/src/whitemarket/_generated/auth_token.py +15 -0
  38. whitemarket_sdk-0.1.0/src/whitemarket/_generated/base_client.py +14 -0
  39. whitemarket_sdk-0.1.0/src/whitemarket/_generated/base_model.py +22 -0
  40. whitemarket_sdk-0.1.0/src/whitemarket/_generated/client.py +7674 -0
  41. whitemarket_sdk-0.1.0/src/whitemarket/_generated/deal_balance_hold.py +17 -0
  42. whitemarket_sdk-0.1.0/src/whitemarket/_generated/deal_balances_hold.py +17 -0
  43. whitemarket_sdk-0.1.0/src/whitemarket/_generated/deal_buyer_list.py +272 -0
  44. whitemarket_sdk-0.1.0/src/whitemarket/_generated/deal_buyer_statuses.py +41 -0
  45. whitemarket_sdk-0.1.0/src/whitemarket/_generated/deal_cancel_sending_offer.py +156 -0
  46. whitemarket_sdk-0.1.0/src/whitemarket/_generated/deal_history.py +162 -0
  47. whitemarket_sdk-0.1.0/src/whitemarket/_generated/deal_history_item.py +140 -0
  48. whitemarket_sdk-0.1.0/src/whitemarket/_generated/deal_item.py +256 -0
  49. whitemarket_sdk-0.1.0/src/whitemarket/_generated/deal_request_cancel.py +292 -0
  50. whitemarket_sdk-0.1.0/src/whitemarket/_generated/deal_seller_list.py +276 -0
  51. whitemarket_sdk-0.1.0/src/whitemarket/_generated/deal_steam_offer_sent.py +306 -0
  52. whitemarket_sdk-0.1.0/src/whitemarket/_generated/email_confirm.py +20 -0
  53. whitemarket_sdk-0.1.0/src/whitemarket/_generated/email_confirmation_resend.py +26 -0
  54. whitemarket_sdk-0.1.0/src/whitemarket/_generated/email_set.py +20 -0
  55. whitemarket_sdk-0.1.0/src/whitemarket/_generated/enums.py +753 -0
  56. whitemarket_sdk-0.1.0/src/whitemarket/_generated/fragments.py +416 -0
  57. whitemarket_sdk-0.1.0/src/whitemarket/_generated/input_types.py +551 -0
  58. whitemarket_sdk-0.1.0/src/whitemarket/_generated/inventory_my.py +278 -0
  59. whitemarket_sdk-0.1.0/src/whitemarket/_generated/inventory_update.py +22 -0
  60. whitemarket_sdk-0.1.0/src/whitemarket/_generated/market_buy.py +262 -0
  61. whitemarket_sdk-0.1.0/src/whitemarket/_generated/market_csgo_stickers_suggestion.py +38 -0
  62. whitemarket_sdk-0.1.0/src/whitemarket/_generated/market_edit.py +179 -0
  63. whitemarket_sdk-0.1.0/src/whitemarket/_generated/market_edit_multiple.py +255 -0
  64. whitemarket_sdk-0.1.0/src/whitemarket/_generated/market_item.py +179 -0
  65. whitemarket_sdk-0.1.0/src/whitemarket/_generated/market_lifetime_all.py +10 -0
  66. whitemarket_sdk-0.1.0/src/whitemarket/_generated/market_list.py +212 -0
  67. whitemarket_sdk-0.1.0/src/whitemarket/_generated/market_my.py +210 -0
  68. whitemarket_sdk-0.1.0/src/whitemarket/_generated/market_new.py +178 -0
  69. whitemarket_sdk-0.1.0/src/whitemarket/_generated/market_new_multiple.py +251 -0
  70. whitemarket_sdk-0.1.0/src/whitemarket/_generated/market_remove.py +246 -0
  71. whitemarket_sdk-0.1.0/src/whitemarket/_generated/market_remove_multiple.py +259 -0
  72. whitemarket_sdk-0.1.0/src/whitemarket/_generated/market_trade_url.py +10 -0
  73. whitemarket_sdk-0.1.0/src/whitemarket/_generated/order_activate.py +41 -0
  74. whitemarket_sdk-0.1.0/src/whitemarket/_generated/order_auto_activate.py +10 -0
  75. whitemarket_sdk-0.1.0/src/whitemarket/_generated/order_deactivate.py +44 -0
  76. whitemarket_sdk-0.1.0/src/whitemarket/_generated/order_deactivate_all.py +10 -0
  77. whitemarket_sdk-0.1.0/src/whitemarket/_generated/order_delete.py +41 -0
  78. whitemarket_sdk-0.1.0/src/whitemarket/_generated/order_delete_all.py +10 -0
  79. whitemarket_sdk-0.1.0/src/whitemarket/_generated/order_edit.py +37 -0
  80. whitemarket_sdk-0.1.0/src/whitemarket/_generated/order_list.py +288 -0
  81. whitemarket_sdk-0.1.0/src/whitemarket/_generated/order_my.py +63 -0
  82. whitemarket_sdk-0.1.0/src/whitemarket/_generated/order_my_active.py +66 -0
  83. whitemarket_sdk-0.1.0/src/whitemarket/_generated/order_my_fulfilled.py +71 -0
  84. whitemarket_sdk-0.1.0/src/whitemarket/_generated/order_my_inactive.py +71 -0
  85. whitemarket_sdk-0.1.0/src/whitemarket/_generated/order_new.py +37 -0
  86. whitemarket_sdk-0.1.0/src/whitemarket/_generated/person_profile.py +20 -0
  87. whitemarket_sdk-0.1.0/src/whitemarket/_generated/profile_id.py +10 -0
  88. whitemarket_sdk-0.1.0/src/whitemarket/_generated/profile_referrer.py +10 -0
  89. whitemarket_sdk-0.1.0/src/whitemarket/_generated/profile_referrer_code.py +10 -0
  90. whitemarket_sdk-0.1.0/src/whitemarket/_generated/profile_steam_link.py +10 -0
  91. whitemarket_sdk-0.1.0/src/whitemarket/_generated/profile_steam_proxy_delete.py +10 -0
  92. whitemarket_sdk-0.1.0/src/whitemarket/_generated/profile_steam_proxy_get.py +14 -0
  93. whitemarket_sdk-0.1.0/src/whitemarket/_generated/profile_steam_proxy_set.py +10 -0
  94. whitemarket_sdk-0.1.0/src/whitemarket/_generated/profile_token_check.py +12 -0
  95. whitemarket_sdk-0.1.0/src/whitemarket/_generated/profile_token_delete.py +10 -0
  96. whitemarket_sdk-0.1.0/src/whitemarket/_generated/profile_token_set.py +10 -0
  97. whitemarket_sdk-0.1.0/src/whitemarket/_generated/store_edit.py +71 -0
  98. whitemarket_sdk-0.1.0/src/whitemarket/_generated/store_my.py +71 -0
  99. whitemarket_sdk-0.1.0/src/whitemarket/_generated/sync_client.py +7674 -0
  100. whitemarket_sdk-0.1.0/src/whitemarket/_generated/test_ping.py +10 -0
  101. whitemarket_sdk-0.1.0/src/whitemarket/_generated/wallet_balance.py +15 -0
  102. whitemarket_sdk-0.1.0/src/whitemarket/_generated/wallet_balances.py +17 -0
  103. whitemarket_sdk-0.1.0/src/whitemarket/_generated/wallet_credit_available.py +17 -0
  104. whitemarket_sdk-0.1.0/src/whitemarket/_generated/wallet_credit_get.py +26 -0
  105. whitemarket_sdk-0.1.0/src/whitemarket/_generated/wallet_credit_max.py +17 -0
  106. whitemarket_sdk-0.1.0/src/whitemarket/_generated/wallet_credit_used.py +17 -0
  107. whitemarket_sdk-0.1.0/src/whitemarket/_generated/wallet_deposits.py +39 -0
  108. whitemarket_sdk-0.1.0/src/whitemarket/_generated/wallet_transactions.py +71 -0
  109. whitemarket_sdk-0.1.0/src/whitemarket/_generated/wallet_transfer_send.py +26 -0
  110. whitemarket_sdk-0.1.0/src/whitemarket/_generated/wallet_transfers.py +48 -0
  111. whitemarket_sdk-0.1.0/src/whitemarket/_generated/wallet_withdrawals.py +35 -0
  112. whitemarket_sdk-0.1.0/src/whitemarket/_mappers/__init__.py +6 -0
  113. whitemarket_sdk-0.1.0/src/whitemarket/_mappers/common.py +97 -0
  114. whitemarket_sdk-0.1.0/src/whitemarket/_mappers/deals.py +201 -0
  115. whitemarket_sdk-0.1.0/src/whitemarket/_mappers/products.py +282 -0
  116. whitemarket_sdk-0.1.0/src/whitemarket/_mappers/profile.py +55 -0
  117. whitemarket_sdk-0.1.0/src/whitemarket/_mappers/search.py +275 -0
  118. whitemarket_sdk-0.1.0/src/whitemarket/_mappers/store.py +91 -0
  119. whitemarket_sdk-0.1.0/src/whitemarket/_mappers/wallet.py +178 -0
  120. whitemarket_sdk-0.1.0/src/whitemarket/_mappers/wire.py +95 -0
  121. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/__init__.py +2 -0
  122. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/attempts.py +20 -0
  123. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/body.py +195 -0
  124. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/credential_format.py +17 -0
  125. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/decimals.py +20 -0
  126. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/decode.py +24 -0
  127. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/download_sink.py +147 -0
  128. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/endpoints.py +154 -0
  129. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/enums.py +32 -0
  130. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/export_redirect.py +68 -0
  131. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/export_urls.py +40 -0
  132. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/filter_checks.py +32 -0
  133. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/http_errors.py +39 -0
  134. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/json_codec.py +132 -0
  135. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/jwt.py +99 -0
  136. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/log_redaction.py +54 -0
  137. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/operation.py +42 -0
  138. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/rejection.py +56 -0
  139. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/retry_after.py +108 -0
  140. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/safe_log.py +25 -0
  141. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/secret.py +90 -0
  142. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/stored_token.py +13 -0
  143. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/text_args.py +30 -0
  144. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/transport_config.py +30 -0
  145. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/typename.py +29 -0
  146. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/unset.py +26 -0
  147. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/uuids.py +13 -0
  148. whitemarket_sdk-0.1.0/src/whitemarket/_runtime/wire_text.py +31 -0
  149. whitemarket_sdk-0.1.0/src/whitemarket/_sync/__init__.py +2 -0
  150. whitemarket_sdk-0.1.0/src/whitemarket/_sync/buying.py +264 -0
  151. whitemarket_sdk-0.1.0/src/whitemarket/_sync/client.py +277 -0
  152. whitemarket_sdk-0.1.0/src/whitemarket/_sync/credentials.py +88 -0
  153. whitemarket_sdk-0.1.0/src/whitemarket/_sync/deal_lookup.py +31 -0
  154. whitemarket_sdk-0.1.0/src/whitemarket/_sync/deals.py +406 -0
  155. whitemarket_sdk-0.1.0/src/whitemarket/_sync/executor.py +26 -0
  156. whitemarket_sdk-0.1.0/src/whitemarket/_sync/export_cache.py +31 -0
  157. whitemarket_sdk-0.1.0/src/whitemarket/_sync/export_stream.py +60 -0
  158. whitemarket_sdk-0.1.0/src/whitemarket/_sync/export_transport.py +344 -0
  159. whitemarket_sdk-0.1.0/src/whitemarket/_sync/exports.py +253 -0
  160. whitemarket_sdk-0.1.0/src/whitemarket/_sync/graphql.py +123 -0
  161. whitemarket_sdk-0.1.0/src/whitemarket/_sync/graphql_base.py +54 -0
  162. whitemarket_sdk-0.1.0/src/whitemarket/_sync/http_reply.py +56 -0
  163. whitemarket_sdk-0.1.0/src/whitemarket/_sync/inventory.py +74 -0
  164. whitemarket_sdk-0.1.0/src/whitemarket/_sync/market.py +89 -0
  165. whitemarket_sdk-0.1.0/src/whitemarket/_sync/pagination.py +54 -0
  166. whitemarket_sdk-0.1.0/src/whitemarket/_sync/partner_token.py +122 -0
  167. whitemarket_sdk-0.1.0/src/whitemarket/_sync/profile.py +134 -0
  168. whitemarket_sdk-0.1.0/src/whitemarket/_sync/seams.py +37 -0
  169. whitemarket_sdk-0.1.0/src/whitemarket/_sync/selling.py +297 -0
  170. whitemarket_sdk-0.1.0/src/whitemarket/_sync/store.py +35 -0
  171. whitemarket_sdk-0.1.0/src/whitemarket/_sync/tokens.py +67 -0
  172. whitemarket_sdk-0.1.0/src/whitemarket/_sync/transport.py +234 -0
  173. whitemarket_sdk-0.1.0/src/whitemarket/_sync/wallet.py +173 -0
  174. whitemarket_sdk-0.1.0/src/whitemarket/_version.py +3 -0
  175. whitemarket_sdk-0.1.0/src/whitemarket/config.py +56 -0
  176. whitemarket_sdk-0.1.0/src/whitemarket/deals/__init__.py +6 -0
  177. whitemarket_sdk-0.1.0/src/whitemarket/deals/history.py +97 -0
  178. whitemarket_sdk-0.1.0/src/whitemarket/deals/until.py +53 -0
  179. whitemarket_sdk-0.1.0/src/whitemarket/errors/__init__.py +55 -0
  180. whitemarket_sdk-0.1.0/src/whitemarket/errors/_redact.py +287 -0
  181. whitemarket_sdk-0.1.0/src/whitemarket/errors/base.py +172 -0
  182. whitemarket_sdk-0.1.0/src/whitemarket/errors/category.py +23 -0
  183. whitemarket_sdk-0.1.0/src/whitemarket/errors/graphql.py +135 -0
  184. whitemarket_sdk-0.1.0/src/whitemarket/errors/http.py +58 -0
  185. whitemarket_sdk-0.1.0/src/whitemarket/exports/__init__.py +39 -0
  186. whitemarket_sdk-0.1.0/src/whitemarket/exports/_csv_rows.py +161 -0
  187. whitemarket_sdk-0.1.0/src/whitemarket/exports/_json_rows.py +187 -0
  188. whitemarket_sdk-0.1.0/src/whitemarket/exports/_limits.py +15 -0
  189. whitemarket_sdk-0.1.0/src/whitemarket/exports/_stream.py +153 -0
  190. whitemarket_sdk-0.1.0/src/whitemarket/exports/conditional.py +27 -0
  191. whitemarket_sdk-0.1.0/src/whitemarket/exports/kinds.py +17 -0
  192. whitemarket_sdk-0.1.0/src/whitemarket/exports/links.py +35 -0
  193. whitemarket_sdk-0.1.0/src/whitemarket/exports/mappers.py +185 -0
  194. whitemarket_sdk-0.1.0/src/whitemarket/exports/meta.py +81 -0
  195. whitemarket_sdk-0.1.0/src/whitemarket/exports/options.py +45 -0
  196. whitemarket_sdk-0.1.0/src/whitemarket/exports/price_list.py +46 -0
  197. whitemarket_sdk-0.1.0/src/whitemarket/exports/rows.py +64 -0
  198. whitemarket_sdk-0.1.0/src/whitemarket/exports/window.py +19 -0
  199. whitemarket_sdk-0.1.0/src/whitemarket/inventory/__init__.py +5 -0
  200. whitemarket_sdk-0.1.0/src/whitemarket/inventory/filter.py +63 -0
  201. whitemarket_sdk-0.1.0/src/whitemarket/live/__init__.py +48 -0
  202. whitemarket_sdk-0.1.0/src/whitemarket/live/_connection.py +128 -0
  203. whitemarket_sdk-0.1.0/src/whitemarket/live/_engine.py +546 -0
  204. whitemarket_sdk-0.1.0/src/whitemarket/live/_envelope.py +533 -0
  205. whitemarket_sdk-0.1.0/src/whitemarket/live/_handlers.py +76 -0
  206. whitemarket_sdk-0.1.0/src/whitemarket/live/_policy.py +100 -0
  207. whitemarket_sdk-0.1.0/src/whitemarket/live/_registry.py +55 -0
  208. whitemarket_sdk-0.1.0/src/whitemarket/live/_sse.py +253 -0
  209. whitemarket_sdk-0.1.0/src/whitemarket/live/_sse_parser.py +103 -0
  210. whitemarket_sdk-0.1.0/src/whitemarket/live/_ws.py +355 -0
  211. whitemarket_sdk-0.1.0/src/whitemarket/live/async_session.py +130 -0
  212. whitemarket_sdk-0.1.0/src/whitemarket/live/events.py +194 -0
  213. whitemarket_sdk-0.1.0/src/whitemarket/live/options.py +38 -0
  214. whitemarket_sdk-0.1.0/src/whitemarket/live/session.py +294 -0
  215. whitemarket_sdk-0.1.0/src/whitemarket/market/__init__.py +5 -0
  216. whitemarket_sdk-0.1.0/src/whitemarket/market/filter.py +125 -0
  217. whitemarket_sdk-0.1.0/src/whitemarket/models/__init__.py +136 -0
  218. whitemarket_sdk-0.1.0/src/whitemarket/models/account_enums.py +254 -0
  219. whitemarket_sdk-0.1.0/src/whitemarket/models/deal_status.py +103 -0
  220. whitemarket_sdk-0.1.0/src/whitemarket/models/deals.py +87 -0
  221. whitemarket_sdk-0.1.0/src/whitemarket/models/enums.py +453 -0
  222. whitemarket_sdk-0.1.0/src/whitemarket/models/money.py +62 -0
  223. whitemarket_sdk-0.1.0/src/whitemarket/models/page.py +40 -0
  224. whitemarket_sdk-0.1.0/src/whitemarket/models/products.py +104 -0
  225. whitemarket_sdk-0.1.0/src/whitemarket/models/profile.py +68 -0
  226. whitemarket_sdk-0.1.0/src/whitemarket/models/store.py +67 -0
  227. whitemarket_sdk-0.1.0/src/whitemarket/models/wallet.py +134 -0
  228. whitemarket_sdk-0.1.0/src/whitemarket/py.typed +0 -0
  229. whitemarket_sdk-0.1.0/src/whitemarket/retry.py +102 -0
  230. whitemarket_sdk-0.1.0/src/whitemarket/selling/__init__.py +23 -0
  231. whitemarket_sdk-0.1.0/src/whitemarket/selling/_batch.py +120 -0
  232. whitemarket_sdk-0.1.0/src/whitemarket/selling/_checks.py +20 -0
  233. whitemarket_sdk-0.1.0/src/whitemarket/selling/_references.py +60 -0
  234. whitemarket_sdk-0.1.0/src/whitemarket/selling/items.py +41 -0
  235. whitemarket_sdk-0.1.0/src/whitemarket/selling/options.py +43 -0
  236. whitemarket_sdk-0.1.0/src/whitemarket/selling/results.py +38 -0
  237. whitemarket_sdk-0.1.0/src/whitemarket/store/__init__.py +5 -0
  238. whitemarket_sdk-0.1.0/src/whitemarket/store/settings.py +26 -0
  239. whitemarket_sdk-0.1.0/src/whitemarket/wallet/__init__.py +5 -0
  240. whitemarket_sdk-0.1.0/src/whitemarket/wallet/filter.py +65 -0
  241. whitemarket_sdk-0.1.0/tests/fixtures/exports/prices.csv +5 -0
  242. whitemarket_sdk-0.1.0/tests/fixtures/exports/prices.json +6 -0
  243. whitemarket_sdk-0.1.0/tests/fixtures/exports/prices.meta.json +1 -0
  244. whitemarket_sdk-0.1.0/tests/fixtures/exports/products.csv +5 -0
  245. whitemarket_sdk-0.1.0/tests/fixtures/exports/products.json +7 -0
  246. whitemarket_sdk-0.1.0/tests/memory/test_streaming_memory.py +72 -0
  247. whitemarket_sdk-0.1.0/tests/support/__init__.py +1 -0
  248. whitemarket_sdk-0.1.0/tests/support/account_payloads.py +222 -0
  249. whitemarket_sdk-0.1.0/tests/support/clients.py +76 -0
  250. whitemarket_sdk-0.1.0/tests/support/deal_apis.py +142 -0
  251. whitemarket_sdk-0.1.0/tests/support/executors.py +73 -0
  252. whitemarket_sdk-0.1.0/tests/support/export_rig.py +141 -0
  253. whitemarket_sdk-0.1.0/tests/support/exports.py +98 -0
  254. whitemarket_sdk-0.1.0/tests/support/flavors.py +85 -0
  255. whitemarket_sdk-0.1.0/tests/support/graphql_docs.py +136 -0
  256. whitemarket_sdk-0.1.0/tests/support/http.py +80 -0
  257. whitemarket_sdk-0.1.0/tests/support/live_fakes.py +143 -0
  258. whitemarket_sdk-0.1.0/tests/support/live_servers.py +274 -0
  259. whitemarket_sdk-0.1.0/tests/support/loopback.py +160 -0
  260. whitemarket_sdk-0.1.0/tests/support/market_payloads.py +221 -0
  261. whitemarket_sdk-0.1.0/tests/support/payloads.py +76 -0
  262. whitemarket_sdk-0.1.0/tests/support/rigs.py +124 -0
  263. whitemarket_sdk-0.1.0/tests/support/selling_payloads.py +111 -0
  264. whitemarket_sdk-0.1.0/tests/unit/auth/test_jwt.py +169 -0
  265. whitemarket_sdk-0.1.0/tests/unit/auth/test_partner_token.py +452 -0
  266. whitemarket_sdk-0.1.0/tests/unit/auth/test_single_flight.py +220 -0
  267. whitemarket_sdk-0.1.0/tests/unit/buying/test_buying_api.py +817 -0
  268. whitemarket_sdk-0.1.0/tests/unit/client/test_client.py +590 -0
  269. whitemarket_sdk-0.1.0/tests/unit/client/test_client_exports.py +89 -0
  270. whitemarket_sdk-0.1.0/tests/unit/conftest.py +19 -0
  271. whitemarket_sdk-0.1.0/tests/unit/deals/test_deals_api.py +1035 -0
  272. whitemarket_sdk-0.1.0/tests/unit/deals/test_until.py +97 -0
  273. whitemarket_sdk-0.1.0/tests/unit/deals/test_wait_for.py +504 -0
  274. whitemarket_sdk-0.1.0/tests/unit/deals/test_wait_for_live.py +124 -0
  275. whitemarket_sdk-0.1.0/tests/unit/errors/test_batch_rejection.py +94 -0
  276. whitemarket_sdk-0.1.0/tests/unit/errors/test_errors.py +284 -0
  277. whitemarket_sdk-0.1.0/tests/unit/errors/test_mutation_rejection.py +92 -0
  278. whitemarket_sdk-0.1.0/tests/unit/errors/test_redact.py +532 -0
  279. whitemarket_sdk-0.1.0/tests/unit/examples/test_examples.py +225 -0
  280. whitemarket_sdk-0.1.0/tests/unit/exports/conftest.py +24 -0
  281. whitemarket_sdk-0.1.0/tests/unit/exports/test_csv_rows.py +258 -0
  282. whitemarket_sdk-0.1.0/tests/unit/exports/test_export_client.py +238 -0
  283. whitemarket_sdk-0.1.0/tests/unit/exports/test_export_loopback.py +258 -0
  284. whitemarket_sdk-0.1.0/tests/unit/exports/test_export_stale_and_download.py +555 -0
  285. whitemarket_sdk-0.1.0/tests/unit/exports/test_export_transport.py +683 -0
  286. whitemarket_sdk-0.1.0/tests/unit/exports/test_json_rows.py +306 -0
  287. whitemarket_sdk-0.1.0/tests/unit/exports/test_links.py +114 -0
  288. whitemarket_sdk-0.1.0/tests/unit/exports/test_meta_and_window.py +194 -0
  289. whitemarket_sdk-0.1.0/tests/unit/exports/test_price_list.py +139 -0
  290. whitemarket_sdk-0.1.0/tests/unit/exports/test_redirect_and_options.py +120 -0
  291. whitemarket_sdk-0.1.0/tests/unit/exports/test_row_mapping.py +452 -0
  292. whitemarket_sdk-0.1.0/tests/unit/exports/test_stream.py +248 -0
  293. whitemarket_sdk-0.1.0/tests/unit/generated/test_client.py +122 -0
  294. whitemarket_sdk-0.1.0/tests/unit/generated/test_decode.py +301 -0
  295. whitemarket_sdk-0.1.0/tests/unit/generated/test_generated_source.py +117 -0
  296. whitemarket_sdk-0.1.0/tests/unit/generated/test_selection_invariants.py +88 -0
  297. whitemarket_sdk-0.1.0/tests/unit/inventory/test_inventory_api.py +285 -0
  298. whitemarket_sdk-0.1.0/tests/unit/inventory/test_inventory_filter.py +48 -0
  299. whitemarket_sdk-0.1.0/tests/unit/live/test_client_live.py +39 -0
  300. whitemarket_sdk-0.1.0/tests/unit/live/test_engine_reconnect.py +179 -0
  301. whitemarket_sdk-0.1.0/tests/unit/live/test_engine_streak_and_close.py +77 -0
  302. whitemarket_sdk-0.1.0/tests/unit/live/test_engine_tokens.py +195 -0
  303. whitemarket_sdk-0.1.0/tests/unit/live/test_envelope_decode.py +372 -0
  304. whitemarket_sdk-0.1.0/tests/unit/live/test_event_mapping.py +647 -0
  305. whitemarket_sdk-0.1.0/tests/unit/live/test_events.py +142 -0
  306. whitemarket_sdk-0.1.0/tests/unit/live/test_live_integration.py +460 -0
  307. whitemarket_sdk-0.1.0/tests/unit/live/test_session_dispatch.py +312 -0
  308. whitemarket_sdk-0.1.0/tests/unit/live/test_sse_connection.py +439 -0
  309. whitemarket_sdk-0.1.0/tests/unit/live/test_sse_parser.py +245 -0
  310. whitemarket_sdk-0.1.0/tests/unit/live/test_sync_session_threads.py +95 -0
  311. whitemarket_sdk-0.1.0/tests/unit/live/test_token_in_tracebacks.py +348 -0
  312. whitemarket_sdk-0.1.0/tests/unit/live/test_ws_connection.py +712 -0
  313. whitemarket_sdk-0.1.0/tests/unit/mappers/test_common_mappers.py +40 -0
  314. whitemarket_sdk-0.1.0/tests/unit/mappers/test_deal_mapping.py +220 -0
  315. whitemarket_sdk-0.1.0/tests/unit/mappers/test_product_mapping.py +300 -0
  316. whitemarket_sdk-0.1.0/tests/unit/mappers/test_search_argument.py +45 -0
  317. whitemarket_sdk-0.1.0/tests/unit/market/test_market_api.py +363 -0
  318. whitemarket_sdk-0.1.0/tests/unit/market/test_product_filter.py +283 -0
  319. whitemarket_sdk-0.1.0/tests/unit/models/test_deal_status.py +111 -0
  320. whitemarket_sdk-0.1.0/tests/unit/models/test_enum_parity.py +136 -0
  321. whitemarket_sdk-0.1.0/tests/unit/models/test_money.py +88 -0
  322. whitemarket_sdk-0.1.0/tests/unit/models/test_page_and_decimals.py +52 -0
  323. whitemarket_sdk-0.1.0/tests/unit/profile/test_profile_api.py +490 -0
  324. whitemarket_sdk-0.1.0/tests/unit/runtime/test_json_codec.py +204 -0
  325. whitemarket_sdk-0.1.0/tests/unit/runtime/test_small_helpers.py +298 -0
  326. whitemarket_sdk-0.1.0/tests/unit/runtime/test_text_args.py +58 -0
  327. whitemarket_sdk-0.1.0/tests/unit/runtime/test_unknown_values.py +153 -0
  328. whitemarket_sdk-0.1.0/tests/unit/selling/test_listing_inputs.py +207 -0
  329. whitemarket_sdk-0.1.0/tests/unit/selling/test_selling_batch.py +696 -0
  330. whitemarket_sdk-0.1.0/tests/unit/selling/test_selling_single.py +343 -0
  331. whitemarket_sdk-0.1.0/tests/unit/store/test_store_api.py +249 -0
  332. whitemarket_sdk-0.1.0/tests/unit/store/test_store_settings.py +107 -0
  333. whitemarket_sdk-0.1.0/tests/unit/test_concurrency.py +61 -0
  334. whitemarket_sdk-0.1.0/tests/unit/test_secret.py +150 -0
  335. whitemarket_sdk-0.1.0/tests/unit/test_version.py +7 -0
  336. whitemarket_sdk-0.1.0/tests/unit/tools/test_audit_fix.py +147 -0
  337. whitemarket_sdk-0.1.0/tests/unit/tools/test_check_build_pin.py +35 -0
  338. whitemarket_sdk-0.1.0/tests/unit/tools/test_live_smoke.py +237 -0
  339. whitemarket_sdk-0.1.0/tests/unit/tools/test_mutation_gate.py +289 -0
  340. whitemarket_sdk-0.1.0/tests/unit/tools/test_unasync.py +219 -0
  341. whitemarket_sdk-0.1.0/tests/unit/transport/test_body.py +270 -0
  342. whitemarket_sdk-0.1.0/tests/unit/transport/test_executor.py +246 -0
  343. whitemarket_sdk-0.1.0/tests/unit/transport/test_loopback.py +275 -0
  344. whitemarket_sdk-0.1.0/tests/unit/transport/test_retry_policy.py +127 -0
  345. whitemarket_sdk-0.1.0/tests/unit/transport/test_transport.py +478 -0
  346. whitemarket_sdk-0.1.0/tests/unit/wallet/test_wallet_filter.py +97 -0
  347. whitemarket_sdk-0.1.0/tests/unit/wallet/test_wallet_money_mutations.py +292 -0
  348. whitemarket_sdk-0.1.0/tests/unit/wallet/test_wallet_reads.py +516 -0
@@ -0,0 +1,37 @@
1
+ # IDE
2
+ .idea/
3
+
4
+ # Local agent brief with local paths, never published
5
+ docs/KICKOFF_PROMPT.md
6
+
7
+ # Python
8
+ __pycache__/
9
+ *.py[cod]
10
+ *.egg-info/
11
+ .venv/
12
+ .venv-codegen/
13
+ .mypy_cache/
14
+ .pytest_cache/
15
+ .ruff_cache/
16
+ .coverage
17
+ .coverage.*
18
+ htmlcov/
19
+ mutants/
20
+ build/
21
+ dist/
22
+
23
+ # Make output (QC logs, codegen-check, live-smoke reports)
24
+ var/
25
+
26
+ # Local environment (secrets never committed)
27
+ .env*
28
+ !.env.example
29
+
30
+ # Editors
31
+ .vscode/
32
+
33
+ # Codegen tool dependencies
34
+ tools/codegen/node_modules/
35
+
36
+ # Agent session handoffs (local only)
37
+ HANDOFF_*.md
@@ -0,0 +1,123 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+ While the version is `0.x`, a minor release (`0.2.0`) may contain breaking changes; they are always listed under
7
+ "Breaking".
8
+
9
+ ## [Unreleased]
10
+
11
+ ## [0.1.0] - 2026-11-16
12
+
13
+ First release of the Python SDK for the WhiteMarket partner API. Requires Python 3.11 or newer (CPython 3.11 to 3.15);
14
+ extras `exports` (`ijson`) and `live` (`websockets`, with an own Centrifugo protocol client).
15
+
16
+ ### Added
17
+
18
+ - Clients: `WhiteMarketClient` (sync) and `AsyncWhiteMarketClient` (async) with the same method names, built from one
19
+ async source (the sync twin is generated by `tools/unasync.py`). Options as in SDK_SPEC 2 (an endpoint option outside
20
+ printable ASCII, longer than 2048 characters, one httpx cannot build a request for, or with a port outside
21
+ 1-65535 or with a sign, is refused at construction; an empty or zero-padded port is the default port); `from_env()` reads
22
+ `WHITEMARKET_PARTNER_TOKEN`. `client.auth` (`access_token`, `refresh`, `ping`), token stores, single-flight token
23
+ exchange with one refresh and replay on a 401 (the replay shares the call's attempt budget; a JWT whose `exp` is past
24
+ or within 5 minutes is exchanged again before the next request), `Secret` for every credential, `RetryPolicy`, `Timeouts`,
25
+ `BuyReconciliation`, the error hierarchy of SDK_SPEC 1.5 and redacted logging.
26
+ - Generated layer (`client.generated`): a typed method for every operation of the partner schema plus `execute()` for
27
+ a hand-written document; regenerated by `make codegen`, and by the `schema-sync` workflow when the schema changes.
28
+ - Examples (`examples/`, `make example NAME=...`): `auth_and_ping`, `search_market`, `iterate_all_listings`,
29
+ `buy_cheapest_by_name`, `buy_product_by_id`, `track_deal_polling`, `track_deal_live`, `sell_semi`, `sell_manual`,
30
+ `export_prices_lookup`, `export_products_stream`, `sse_products_feed`, `ws_products_feed`, `ws_personal_deals`,
31
+ `raw_generated_operation`. The scripts that move money need `--yes` and print a dry run otherwise.
32
+ README, CONTRIBUTING and SECURITY are complete.
33
+ - Exports (`whitemarket.exports`, `ExportClient` / `AsyncExportClient`, SDK_SPEC 3.10): beyond the spec, the row decoders
34
+ `iter_price_rows`, `iter_product_rows`, `aiter_price_rows`, `aiter_product_rows` stay public (they decode the chunks of
35
+ a file the caller downloaded itself); the other decoder internals are private. `RetryPolicy.should_retry_export` is the
36
+ public retry rule of an export GET (429 and every 5xx).
37
+ Every SDK request (GraphQL query, mutation and auth, export GET, SSE GET) is sent with `follow_redirects=False` and
38
+ `auth=None`, so an injected `http_client` can no longer follow a redirect or apply its `auth`; an export request also
39
+ carries none of the injected client's default headers or cookies. A download writes through a private (0600) temporary
40
+ file and gives the result the mode of the file it replaces, or the mode a new file would get. A cancelled `download`
41
+ leaves no temporary file. A row stream dropped without `close()` closes its connection when it is collected.
42
+ - Live updates: `client.live(LiveTransport.WS | SSE, LiveOptions)` returns `LiveSession` (sync, background thread,
43
+ blocking `poll(timeout)`) or `AsyncLiveSession`; typed events (`ProductAdded`, `ProductEdited`, `ProductRemoved`, the
44
+ eight `Deal*` events, `UnknownEvent`), `subscribe_products`, `subscribe_personal`, `on`, lifecycle callbacks,
45
+ `wait_for_deal_event`. WebSocket needs the `live` extra (ADR 0005). `LiveConnectionError` now carries `code` and
46
+ `reason`. SSE accepts publications that the server sends before the connect reply and delivers them after
47
+ `on_connected` (before this, such a connect failed with a `TransportError` and was retried).
48
+ `LiveSession.close()` from another thread always wakes a consumer blocked in `poll()` (before this, a
49
+ `poll()` that ended in the same loop turn as the close could wait forever). An SSE URL that httpx refuses (a
50
+ control character) fails the connect attempt with a `TransportError` (before this, `httpx.InvalidURL` escaped the
51
+ session with the token in its traceback). A GraphQL request httpx cannot build (an injected client's default
52
+ query parameter it cannot encode) is a `TransportError` naming the error class only, never repeated (before this,
53
+ the library error escaped with the access token in its traceback variables). A connect reply `ttl` above one year counts as one year, below 0 as 0
54
+ (before this, a `ttl` beyond the float range failed every connect).
55
+ - High-level models (`whitemarket.models`): `Page`, `PageRequest`, `Product`, `ProductHistory`, `InventoryItem`, `Sticker`,
56
+ `Deal`, `DealState`, `BuyResult`, `DealStatus` (with `is_in_progress`, `is_exchanged`, `is_successful`, `is_failed`,
57
+ `is_reversed`, `is_final`, `awaiting_trade_protection`), `DealCancelReason`, `DealAction`, `TransactionReason` and the
58
+ filter enums; `whitemarket.deals.Until` (`offered`, `exchanged_or_completed`, `completed`, `final`).
59
+ - `client.market` (sync and async): `search`, `iterate`, `get`, `sticker_suggestions`, `check_trade_url`, and
60
+ `whitemarket.market.ProductFilter` / `ProductSort`.
61
+ - `client.buying` (sync and async): `buy_product`, `buy_cheapest`, `buy_by_asset_id` returning `BuyResult`. Every form takes
62
+ an optional `max_price`; `custom_id` (a UUIDv4 when absent, 1 to 100 characters) and `trade_url` are keyword-only.
63
+ `market_buy` is sent once and never retried; an ambiguous failure is reconciled by `custom_id` (SDK_SPEC 3.3), ending in
64
+ `PurchaseOutcomeUnknownError` (now with `last_lookup_error`, the `market_buy` failure as `__cause__`).
65
+ - `client.deals` (sync and async): `get`, `statuses`, `list_as_buyer`, `list_as_seller`, `history`, `iterate_history`,
66
+ `request_cancel`, `report_offer_sent`, `cancel_sending_offer`, `hold_balance`, `hold_balances`, `wait_for` (seller deals,
67
+ optional `live=` session wake-up; raises the new `DealWaitTimeoutError`), and `whitemarket.deals.DealHistoryFilter` /
68
+ `DealHistorySort`; enums `OfferCancelReason`, `DealHistoryStatus`, `DealHistorySortField`.
69
+ - `client.selling` (sync and async): `list`, `list_many`, `reprice`, `reprice_many`, `remove`, `remove_many`,
70
+ `set_lifetime_for_all`, `my_products`, `iterate_my_products`, and `whitemarket.selling` (`ListingOptions`, `Listing`,
71
+ `PriceChange`, `BatchItemResult`, `BatchOutcome`). The single mutations are sent once and never retried; the `*_many`
72
+ methods send one request per chunk (`selling_batch_size`, default 100, a new client option also accepted by `from_env`),
73
+ report `SUCCEEDED | FAILED | UNKNOWN | NOT_SENT` per item in the caller's order and raise the new `BatchIncompleteError`
74
+ (`results`, failure as `__cause__`) unless every item has a server-reported outcome (SDK_SPEC 3.5).
75
+ - `client.inventory` (sync and async): `list`, `iterate`, `refresh_from_steam`, and `whitemarket.inventory.InventoryFilter`
76
+ (SDK_SPEC 3.6). Items of a game other than CS2 are skipped. `refresh_from_steam` is a mutation, sent once.
77
+ - `client.wallet` (sync and async): `balance`, `balances`, `deposits`, `withdrawals`, `transactions`, `iterate_transactions`,
78
+ `transfers`, `iterate_transfers`, `credit` (one query document with the three credit root fields, retried as a query),
79
+ `take_credit` and `transfer`, and `whitemarket.wallet.WalletTransactionFilter` / `WalletTransactionSort` (SDK_SPEC 3.8).
80
+ `take_credit` and `transfer` are sent once and never retried: a rejection (HTTP 400, 401, 429, a GraphQL error of the root
81
+ field with `data` null) propagates as its own error, any other failure is `MutationOutcomeUnknownError`, whose message names
82
+ the method and where to check (`wallet.credit()` / `wallet.transfers()`) and carries no amount or id.
83
+ Models `Deposit` (`airwallex_secret` is a `Secret`), `Withdrawal`,
84
+ `WalletTransaction`, `WalletTransfer`, `Debt`, `Credit`, `PersonSummary` and the enums `WalletMethod`, `DepositStatus`,
85
+ `WithdrawalStatus`, `TransferStatus`, `TransactionStatus`, `TransactionFeeType`, `TransactionSortField`, `PaymentProvider`,
86
+ `CryptoCurrency`, `CryptoNetwork` (all with an unknown fallback).
87
+ - `client.profile` (sync and async): `id`, `get`, `set_trade_url`, `steam_proxy`, `set_steam_proxy`, `delete_steam_proxy`,
88
+ `set_steam_token`, `check_steam_token`, `delete_steam_token`, `set_email`, `confirm_email`, `resend_email_confirmation`,
89
+ `link_referrer`, `change_referrer_code` (SDK_SPEC 3.9). The proxy and the token payload are `Secret` parameters;
90
+ `steam_proxy()` and `Profile.steam_trade_url` are `Secret | None`. Every mutation is sent once. Model `Profile`,
91
+ `TradingCompetitionStat`, enum `Locale`.
92
+ - `client.store` (sync and async): `get`, `edit(StoreSettings)` and `whitemarket.store.StoreSettings` (`custom_avatar` is
93
+ sent as `encodedCustomAvatar`). Models `Store`, `Achievement`, `AchievementParam` and the enums `StoreAvatar`,
94
+ `StoreBanner`, `AchievementCondition`, `AchievementName`, `AchievementStatus`, `AchievementKind`. A union member of an
95
+ achievement parameter the SDK does not know, and a null entry, are skipped.
96
+ - `GraphQLError.data_present`: whether the response had a `data` key at all (`data: null` counts); a request error omits it.
97
+ - `GraphQLErrorEntry.malformed`: true for an `errors[]` entry that is not shaped like the GraphQL spec; `GraphQLError.partial_data`
98
+ stays `{}` for an empty `data` object (it was `None`). Both keep buy reconciliation from reading an ambiguous error as a
99
+ rejection.
100
+
101
+ ### Known limitations
102
+
103
+ - **No high-level `orders` module yet** (SDK_SPEC 3.7, plan T4.2; as in the PHP SDK 0.1.0). The schema no longer hides
104
+ the order types, but the module is not written. The generated `order_*` operations are available through
105
+ `client.generated`. Planned for the next minor release (`docs/DEVIATIONS.md`).
106
+ - **Error categories.** The server does not publish the catalogue of `extensions.category` values; the SDK knows only
107
+ the ones it has observed (`ErrorCategory`). A GraphQL error that arrives after a purchase or money operation already
108
+ went through, with a category the SDK does not know, is not recognized as such; see "Buying" in the README.
109
+ - **No retry key for selling.** Selling mutations have no idempotency key. If an answer is lost, check
110
+ `selling.my_products()` before trying again.
111
+ - **Live updates.** Product prices are assumed to be USD. Events missed while reconnecting are not replayed (no
112
+ gap-free resume): when `on_connected` reports `reconnected=True`, reload what you need. A WebSocket frame is
113
+ bounded by `LiveOptions.max_message_bytes` (a longer one ends the connection with close code 1009; a frame can hold
114
+ several messages).
115
+ - **Batch results and size.** The base of `MarketProductResult.index` (0 or 1) and the server's maximum batch size for
116
+ selling are unconfirmed. The SDK sends 100 items per request (`selling_batch_size`).
117
+ - **Products CSV.** The SDK assumes the CSV header names the same keys as the JSON file.
118
+ - **Seller deal product id.** `sell_semi` and `sell_manual` assume that the product id of a seller deal equals the id
119
+ of the listed product; the API docs do not state it.
120
+ - **Missing deal fields.** The SDK does not request a deal product's `params.updatedAt` and `params.order`, because the
121
+ server currently fails when asked for them.
122
+ - **Live checks pending.** The live smoke test and the live protocol checks have not been run against the real API
123
+ yet; the owner runs them with a test Partner Token before the release.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WhiteMarket
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,464 @@
1
+ Metadata-Version: 2.5
2
+ Name: whitemarket-sdk
3
+ Version: 0.1.0
4
+ Summary: Python SDK for the WhiteMarket partner API: GraphQL, public export files, live updates.
5
+ Project-URL: Homepage, https://github.com/whitemarket-official/sdk-python
6
+ Project-URL: Source, https://github.com/whitemarket-official/sdk-python
7
+ Project-URL: Issues, https://github.com/whitemarket-official/sdk-python/issues
8
+ Project-URL: Changelog, https://github.com/whitemarket-official/sdk-python/blob/main/CHANGELOG.md
9
+ Author: WhiteMarket
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Programming Language :: Python :: 3.15
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: httpx>=0.28
25
+ Requires-Dist: pydantic-core
26
+ Requires-Dist: pydantic>=2.8
27
+ Provides-Extra: codegen
28
+ Requires-Dist: ariadne-codegen==0.19.0; extra == 'codegen'
29
+ Requires-Dist: graphql-core==3.2.14; extra == 'codegen'
30
+ Provides-Extra: dev
31
+ Requires-Dist: build==1.6.1; extra == 'dev'
32
+ Requires-Dist: coverage==7.17.3; extra == 'dev'
33
+ Requires-Dist: graphql-core==3.2.14; extra == 'dev'
34
+ Requires-Dist: hatchling==1.33.0; extra == 'dev'
35
+ Requires-Dist: mutmut==3.8.1; extra == 'dev'
36
+ Requires-Dist: mypy==2.4.1; extra == 'dev'
37
+ Requires-Dist: pip-audit==2.10.1; extra == 'dev'
38
+ Requires-Dist: pyright==1.1.414; extra == 'dev'
39
+ Requires-Dist: pytest-asyncio==1.5.0; extra == 'dev'
40
+ Requires-Dist: pytest-cov==7.1.0; extra == 'dev'
41
+ Requires-Dist: pytest==9.2.0; extra == 'dev'
42
+ Requires-Dist: respx==0.23.1; extra == 'dev'
43
+ Requires-Dist: ruff==0.17.5; extra == 'dev'
44
+ Requires-Dist: twine==7.0.0; extra == 'dev'
45
+ Requires-Dist: websockets==17.4; extra == 'dev'
46
+ Provides-Extra: exports
47
+ Requires-Dist: ijson>=3; extra == 'exports'
48
+ Provides-Extra: live
49
+ Requires-Dist: websockets>=17; extra == 'live'
50
+ Provides-Extra: test
51
+ Requires-Dist: coverage==7.17.3; extra == 'test'
52
+ Requires-Dist: graphql-core==3.2.14; extra == 'test'
53
+ Requires-Dist: pytest-asyncio==1.5.0; extra == 'test'
54
+ Requires-Dist: pytest-cov==7.1.0; extra == 'test'
55
+ Requires-Dist: pytest==9.2.0; extra == 'test'
56
+ Requires-Dist: respx==0.23.1; extra == 'test'
57
+ Requires-Dist: websockets==17.4; extra == 'test'
58
+ Description-Content-Type: text/markdown
59
+
60
+ # WhiteMarket Python SDK
61
+
62
+ [![CI](https://github.com/whitemarket-official/sdk-python/actions/workflows/ci.yml/badge.svg)](https://github.com/whitemarket-official/sdk-python/actions/workflows/ci.yml)
63
+ [![PyPI](https://img.shields.io/pypi/v/whitemarket-sdk.svg)](https://pypi.org/project/whitemarket-sdk/)
64
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
65
+
66
+ > Status: `0.x`. The public API may change until `1.0.0`; while the version is `0.x`, a minor release may contain
67
+ > breaking changes, always listed under "Breaking" in the [changelog](CHANGELOG.md).
68
+
69
+ Official Python SDK for the [WhiteMarket](https://white.market) partner API (CS2 skins marketplace).
70
+
71
+ - **Generated layer**: a typed client for every operation of the partner GraphQL schema
72
+ (`https://api.white.market/graphql/partner`), regenerated by a GitHub Actions workflow when the schema changes.
73
+ - **High-level client**: Partner Token authentication with a cached, automatically renewed access token, market search,
74
+ buying with an idempotent `custom_id` and outcome reconciliation, deal tracking, selling, inventory, wallet, profile
75
+ and store. Everything exists as a sync client (`WhiteMarketClient`) and an async client (`AsyncWhiteMarketClient`)
76
+ with the same method names.
77
+ - **Export files**: streaming access to the public price and product exports on `https://export.white.market`, with
78
+ freshness metadata.
79
+ - **Live updates**: Server-Sent Events and WebSocket (Centrifugo) with typed events and automatic reconnect.
80
+
81
+ Not shipped yet: the high-level `orders` (buy orders) module. The generated `order_*` operations work through
82
+ `client.generated`; the module is planned for the next minor release.
83
+
84
+ ## Install
85
+
86
+ ```bash
87
+ pip install whitemarket-sdk # GraphQL client only
88
+ pip install "whitemarket-sdk[exports]" # + streaming export files (ijson)
89
+ pip install "whitemarket-sdk[live]" # + WebSocket live updates (websockets)
90
+ pip install "whitemarket-sdk[exports,live]"
91
+ ```
92
+
93
+ The base install depends on `httpx` and `pydantic`. Reading an export file without the `exports` extra raises an `ImportError`
94
+ naming the extra (JSON streaming needs `ijson`); without the `live` extra only SSE live updates work
95
+ (`LiveTransport.SSE`), and the default WebSocket transport raises an `ImportError` naming the extra.
96
+
97
+ Contributors: `make install` sets up the development setup with uv or pip, see [CONTRIBUTING.md](CONTRIBUTING.md).
98
+
99
+ ## Requirements
100
+
101
+ Python 3.11 or newer: every CPython version in bugfix or security status (3.11 to 3.15 at the time of writing,
102
+ <https://devguide.python.org/versions/>). The package is fully typed (`py.typed`; `mypy --strict` and pyright strict
103
+ clean).
104
+
105
+ ## Quickstart
106
+
107
+ Create a Partner Token in your WhiteMarket account and export it. The SDK reads it and never prints it.
108
+
109
+ ```bash
110
+ export WHITEMARKET_PARTNER_TOKEN=...
111
+ ```
112
+
113
+ ```python
114
+ from whitemarket import WhiteMarketClient
115
+ from whitemarket.market import ProductFilter
116
+ from whitemarket.models import App, Money, PageRequest
117
+
118
+ with WhiteMarketClient.from_env() as client:
119
+ print(client.auth.ping()) # connectivity and credentials check
120
+ page = client.market.search(
121
+ ProductFilter(app=App.CSGO, price_to=Money.usd("5.00")), PageRequest(first=10)
122
+ )
123
+ for product in page:
124
+ print(product.id, product.price) # Money prints as "1.50 USD"
125
+
126
+ # Buy the cheapest listing of an item, at most 5 USD. THIS SPENDS MONEY.
127
+ result = client.buying.buy_cheapest(
128
+ App.CSGO, "AK-47 | Redline (Field-Tested)", max_price=Money.usd("5.00")
129
+ )
130
+ print(result.deal.id, result.custom_id)
131
+ ```
132
+
133
+ The async client has the same methods; every call is awaited and iterators are `async for`:
134
+
135
+ ```python
136
+ import asyncio
137
+
138
+ from whitemarket import AsyncWhiteMarketClient
139
+ from whitemarket.market import ProductFilter
140
+ from whitemarket.models import App, Money
141
+
142
+
143
+ async def main() -> None:
144
+ async with AsyncWhiteMarketClient.from_env() as client:
145
+ async for product in client.market.iterate(ProductFilter(app=App.CSGO, price_to=Money.usd("5.00"))):
146
+ print(product.id, product.price)
147
+ break # iterators are lazy: no further page is requested
148
+
149
+
150
+ asyncio.run(main())
151
+ ```
152
+
153
+ Money and wear values are `decimal.Decimal` (`Money.amount`), never `float`: `Money.usd(1.5)` raises `TypeError`, pass
154
+ `"1.50"` or a `Decimal`. 64-bit ids (asset, class, instance) are strings. Datetimes are timezone-aware.
155
+
156
+ ## Authentication
157
+
158
+ ```python
159
+ WhiteMarketClient(partner_token="...") # preferred: the SDK exchanges it for access tokens and renews them
160
+ WhiteMarketClient(access_token="eyJ...") # you manage the access token (JWT) yourself
161
+ WhiteMarketClient(token_provider=my_provider) # full control: a TokenProvider with access_token() / refresh()
162
+ WhiteMarketClient.from_env() # WHITEMARKET_PARTNER_TOKEN (and optional WHITEMARKET_BASE_URL)
163
+ ```
164
+
165
+ Pass exactly one credential. A Partner Token is exchanged with `auth_token`; the access token is cached, renewed 5
166
+ minutes before it expires, refreshed once on a 401 (the request is then replayed once, within the same attempt budget:
167
+ a query sends at most `max_attempts` requests), and concurrent callers share one exchange (single flight). A token whose
168
+ `exp` is already past or less than 5 minutes ahead serves the request that asked for it and is exchanged again before
169
+ the next one. Tokens and Partner Tokens are `whitemarket.Secret` values: `repr` and `str` print `***`;
170
+ `secret.reveal()` returns the text.
171
+
172
+ **Several processes or workers**: share one `TokenStore` (`get()`, `set(token, expires_at)`, `clear()`; the async client
173
+ takes an `AsyncTokenStore`) so that N workers do not each call the rate-limited `auth_token`. The default is
174
+ `InMemoryTokenStore` / `AsyncInMemoryTokenStore`. Use one store (one key of a shared cache) per Partner Token.
175
+
176
+ ```python
177
+ from whitemarket import InMemoryTokenStore, WhiteMarketClient
178
+
179
+ store = InMemoryTokenStore() # replace with your own TokenStore backed by Redis, a file, ...
180
+ client = WhiteMarketClient(partner_token="...", token_store=store)
181
+ ```
182
+
183
+ ## Buying
184
+
185
+ ```python
186
+ from whitemarket.models import App, Money
187
+
188
+ result = client.buying.buy_cheapest(App.CSGO, "AK-47 | Redline (Field-Tested)", max_price=Money.usd("5.00"), custom_id=my_id)
189
+ result = client.buying.buy_product(product.id, Money.usd("5.00"), custom_id=my_id)
190
+ result = client.buying.buy_by_asset_id(App.CSGO, "123456789", Money.usd("5.00"), custom_id=my_id)
191
+ ```
192
+
193
+ `BuyResult` has `deal`, `custom_id` and `reconciled`.
194
+
195
+ **Idempotency and reconciliation.** A purchase is a GraphQL mutation and mutations are **never retried**, by the transport
196
+ or by anything else. Every purchase carries a `custom_id` (1 to 100 characters; a UUIDv4 when you pass none). If the
197
+ answer is lost (timeout, 5xx, a response that cannot be read), the SDK does not know whether the purchase happened: it
198
+ waits (`BuyReconciliation.delay`, 10 to 20 s, default 15 s), then looks the deal up by `custom_id`
199
+ (`attempts` times, `interval` apart, defaults 3 and 5 s).
200
+
201
+ - The deal is found: you get a normal `BuyResult` with `reconciled=True`.
202
+ - A GraphQL rejection before the purchase ran (insufficient funds, the listing is gone, ...): a `GraphQLError`; nothing
203
+ was bought.
204
+ - No deal is found: `PurchaseOutcomeUnknownError` (`custom_id`, `last_lookup_error`, the original failure as
205
+ `__cause__`). **Do not buy again with a new id.** Look the deal up later with `client.deals.get(custom_id)`; only a
206
+ retry with the *same* `custom_id` is safe.
207
+
208
+ **Persist the `custom_id` in your own storage before you call the buy method**, so it survives a crash between the
209
+ request and the answer. `examples/buy_cheapest_by_name.py` and `examples/buy_product_by_id.py` show the whole flow.
210
+
211
+ ## Deal tracking
212
+
213
+ ```python
214
+ from whitemarket.deals import Until
215
+
216
+ state = client.deals.wait_for(deal_id_or_custom_id, Until.exchanged_or_completed(), poll_interval=30.0)
217
+ print(state.status.value) # DealState: id, custom_id, status, cancel_reason, price, ...
218
+ ```
219
+
220
+ `wait_for` polls `deal_buyer_statuses` (one request for the deal; `deals.statuses(ids)` takes up to 300 ids), works for
221
+ seller deals too, and has no timeout unless you pass `timeout=` (a trade can take hours, so waiting without a limit is the
222
+ sensible default; `DealWaitTimeoutError` carries the last state). Every `Until` predicate (`offered`,
223
+ `exchanged_or_completed`, `completed`, `final`) also matches a final status, so a wait never outlives a cancelled or
224
+ reversed deal: check `state.status`. `DealStatus` has `is_in_progress()`, `is_exchanged()`, `is_successful()`,
225
+ `is_failed()`, `is_reversed()`, `is_final()`. Other deal methods: `get`, `statuses`, `list_as_buyer`, `list_as_seller`,
226
+ `history`, `iterate_history`, `request_cancel`, `report_offer_sent`, `cancel_sending_offer`, `hold_balance(s)`.
227
+
228
+ **Live wake-up.** Pass a live session whose personal channel is subscribed and `wait_for` polls early when an event of the
229
+ deal arrives (an event is a hint; the state is always read from the API):
230
+
231
+ ```python
232
+ with client.live() as live:
233
+ live.subscribe_personal()
234
+ state = client.deals.wait_for(deal_id, Until.exchanged_or_completed(), poll_interval=30.0, live=live)
235
+ ```
236
+
237
+ Examples: `track_deal_polling.py`, `track_deal_live.py`.
238
+
239
+ ## Selling
240
+
241
+ ```python
242
+ from whitemarket.models import DeliveryType, Money
243
+
244
+ product = client.selling.list(item, Money.usd("12.50"), delivery_type=DeliveryType.SEMI)
245
+ client.selling.reprice(product.id, Money.usd("11.90"))
246
+ client.selling.remove(product.id)
247
+ ```
248
+
249
+ - **SEMI**: WhiteMarket sends the Steam trade offer; you confirm it in Steam Mobile. Follow the deal until `EXCHANGED`
250
+ (`examples/sell_semi.py`).
251
+ - **MANUAL**: you send the Steam trade offer yourself, to the buyer's `Deal.receiver_trade_url` (a `Secret`), then call
252
+ `client.deals.report_offer_sent(deal_id, steam_offer_id)`. If you cannot send the item, `deals.cancel_sending_offer()`
253
+ with the TRUE reason: a wrong one can lead to sanctions (`examples/sell_manual.py`).
254
+
255
+ `list_many`, `reprice_many` and `remove_many` take many items, send one request per chunk (`selling_batch_size`, default
256
+ 100; the server's maximum is unconfirmed) and return one `BatchItemResult` per item, in your order, with the outcome
257
+ `SUCCEEDED | FAILED | UNKNOWN | NOT_SENT`. Unless every item has a server-reported outcome they raise
258
+ `BatchIncompleteError` (`results` holds what is known). Selling mutations have no idempotency key and are sent once: after
259
+ an ambiguous failure check `client.selling.my_products()` before repeating.
260
+
261
+ ## Inventory, wallet, profile, store
262
+
263
+ ```python
264
+ page = client.inventory.list() # also iterate(); refresh_from_steam() re-reads your Steam inventory
265
+ balances = client.wallet.balances() # balance(currency), deposits, withdrawals, transactions, transfers, credit
266
+ profile = client.profile.get() # set_trade_url, set_steam_proxy, set_steam_token, set_email, ...
267
+ store = client.store.get() # edit(StoreSettings(...))
268
+ ```
269
+
270
+ `wallet.take_credit` and `wallet.transfer` move money and are sent once, never retried; when the outcome is unknown they raise
271
+ `MutationOutcomeUnknownError` whose message says where to check (`wallet.credit()` / `wallet.transfers()`). Steam proxy and
272
+ token payloads are `Secret` parameters. Filters are the dataclasses `InventoryFilter`, `WalletTransactionFilter`,
273
+ `StoreSettings` and the like; every list method has a one-page form (`list`) and a lazy iterator (`iterate*`).
274
+
275
+ Orders (buy orders): not available in the high-level client yet; see the generated layer below.
276
+
277
+ ## Exports
278
+
279
+ The export files are public: no token. `ExportClient` (and `AsyncExportClient`) is also available as `client.exports`.
280
+ Needs the `exports` extra.
281
+
282
+ ```python
283
+ from whitemarket import ExportClient
284
+ from whitemarket.exports import ExportWindow
285
+
286
+ with ExportClient() as exports:
287
+ prices = exports.prices(window=ExportWindow.MINUTES10, max_age=900) # refuse data older than 15 minutes
288
+ row = prices.get("AK-47 | Redline (Field-Tested)", "282") # (market_hash_name, paint_index)
289
+ print(row.price if row else "not listed")
290
+
291
+ with exports.stream_products(window=ExportWindow.MINUTES10) as rows: # millions of rows, constant memory
292
+ for row in rows:
293
+ ... # leaving the loop closes the connection
294
+ ```
295
+
296
+ `prices()` returns a `PriceList` (`get(name, paint_index="0")`, `all_phases(name)`; with `conditional=True` it may return
297
+ `NotModified`). `stream_prices`, `stream_products` (JSON or CSV) yield rows lazily; `meta()` reads the freshness sidecar
298
+ (`data_as_of`, `generated_at`, `items`); `max_age` raises `StaleExportError` before the file is downloaded; `download()`
299
+ writes a file atomically. Rows keep unknown server fields in `extra`. Only export requests follow redirects (same
300
+ origin rules apply). Examples: `export_prices_lookup.py`, `export_products_stream.py`.
301
+
302
+ ## Live updates
303
+
304
+ ```python
305
+ from whitemarket import LiveTransport, WhiteMarketClient
306
+
307
+ with WhiteMarketClient.from_env() as client, client.live(LiveTransport.SSE) as live:
308
+ live.subscribe_products()
309
+ event = live.poll(5.0) # blocking, returns None after the timeout
310
+ ```
311
+
312
+ `client.live(transport, options)` returns a `LiveSession` (sync: a background thread, blocking `poll(timeout)`, `run`,
313
+ handlers on the caller's thread) or an `AsyncLiveSession` (async client: `await poll()`, `async for event in live`).
314
+ `LiveTransport.WS` (default, needs the `live` extra) or `LiveTransport.SSE` (unidirectional); `LiveOptions` bounds the
315
+ connect time, the SSE event size and the number of reconnects. Events are frozen dataclasses: `ProductAdded`,
316
+ `ProductEdited`, `ProductRemoved` (public channel, `subscribe_products`), the personal deal events `DealInitiated`,
317
+ `DealOffered`, `DealNeedConfirmation`, `DealExchanged`, `DealCompleted`, `DealExpired`, `DealCancelled`, `DealHold`
318
+ (`subscribe_personal`), and `UnknownEvent` for a type the SDK does not know. Register with `live.on(EventType, handler)`
319
+ and `on_connected`, `on_disconnected`, `on_error`, `on_connecting`. The SDK reconnects with backoff and fetches a fresh
320
+ access token before every connect. Events missed while reconnecting are not replayed: when `on_connected` reports
321
+ `reconnected=True`, re-read what you need. Product prices are assumed to be USD. Examples: `sse_products_feed.py`,
322
+ `ws_products_feed.py`, `ws_personal_deals.py` (async).
323
+
324
+ ## Generated layer
325
+
326
+ `client.generated` exposes every operation of the schema as a typed method, on the client's own token, retry policy and
327
+ error mapping. Its names follow the schema (`market_list`, `forward_pagination`), and the typed inputs live in
328
+ `whitemarket._generated`. `execute(document, variables)` sends a hand-written document:
329
+
330
+ ```python
331
+ from whitemarket._generated.input_types import ForwardPaginationInput
332
+
333
+ listing = client.generated.market_list(forward_pagination=ForwardPaginationInput(first=3))
334
+ data = client.generated.execute("query Ping { test_ping }") # the raw `data` dict
335
+ ```
336
+
337
+ A document that is not clearly a query is treated as a mutation and is never retried. Use the generated layer for what the
338
+ high-level client does not cover yet (for example `order_*`). Example: `raw_generated_operation.py`.
339
+
340
+ ## Errors
341
+
342
+ ```
343
+ WhiteMarketError
344
+ ├── TransportError network failure before a response
345
+ ├── DecodeError a response that does not have the expected shape
346
+ ├── HttpError (status, body_excerpt)
347
+ │ ├── BadRequestError (400)
348
+ │ ├── AuthenticationError (401, after the one refresh and replay)
349
+ │ ├── RateLimitError (429, retry_after)
350
+ │ └── ServerError (5xx)
351
+ │ └── ServiceUnavailableError (503, retry_after)
352
+ ├── GraphQLError (errors, partial_data)
353
+ │ └── NotFoundError every error's category ends with ".not_found"
354
+ ├── PurchaseOutcomeUnknownError see Buying
355
+ ├── MutationOutcomeUnknownError see Inventory, wallet, profile, store
356
+ ├── BatchIncompleteError see Selling
357
+ ├── DealWaitTimeoutError
358
+ ├── ExportError
359
+ │ ├── GeneralExportError
360
+ │ └── StaleExportError
361
+ └── LiveConnectionError (code, reason)
362
+ ```
363
+
364
+ **Branch on `extensions.category`, never on an error message**: `GraphQLErrorEntry.category` (and `GraphQLError.has_category`)
365
+ carry it; `whitemarket.errors.ErrorCategory` names the categories the SDK knows. The server does not publish its category
366
+ catalogue, so an unknown category arrives as a plain string. The message is server text: not redacted, never parse it.
367
+ `HttpError.body_excerpt` is at most 512 bytes with credentials replaced by `***`. Unknown is not an error: a new enum value
368
+ decodes to an unknown pseudo-member (`is_unknown`), a new event type to `UnknownEvent`.
369
+
370
+ ## Retries and timeouts
371
+
372
+ - GraphQL **queries** are retried (3 attempts in total by default) on a network error before a response and on 429, 500,
373
+ 502, 503 and 504, with exponential backoff and full jitter (`RetryPolicy`: base 0.5 s, factor 2, cap 30 s). A 429 or
374
+ 503 with `Retry-After` is not retried: you get `RateLimitError` / `ServiceUnavailableError` with `retry_after` at once.
375
+ - **Mutations are never retried** (there is no switch). A 401 refreshes the token once and replays once, because it means
376
+ the request was rejected before it ran. The replay counts against the same attempt budget: a query sends at most
377
+ `max_attempts` requests (a 401 on the last attempt is still replayed once), a mutation at most two.
378
+ - Export GETs are retried on 429 and 5xx; live connections reconnect with backoff.
379
+ - `Timeouts(connect=10, request=30)` seconds. `RetryPolicy.none()` disables query retries.
380
+
381
+ ## Configuration reference
382
+
383
+ `WhiteMarketClient(...)` / `AsyncWhiteMarketClient(...)` keyword-only options; `from_env()` accepts every option except the
384
+ credentials.
385
+
386
+ | Option | Meaning |
387
+ |---|---|
388
+ | `partner_token`, `access_token`, `token_provider` | exactly one credential |
389
+ | `token_store` | where the cached access token lives (with `partner_token` only) |
390
+ | `base_url`, `graphql_path`, `export_base_url`, `sse_url`, `ws_url` | endpoint overrides (https, no embedded credentials, printable ASCII up to 2048 characters, an internationalised host in its `xn--` form; `sse_url` without a query: the SDK appends its own) |
391
+ | `http_client` | an `httpx.Client` (`httpx.AsyncClient` for the async client), see below |
392
+ | `timeouts`, `retry` | `Timeouts`, `RetryPolicy` |
393
+ | `logger` | a `logging.Logger` (default: `logging.getLogger("whitemarket")`) |
394
+ | `user_agent_suffix` | appended to the `User-Agent` |
395
+ | `buy_reconciliation` | `BuyReconciliation(delay=15, attempts=3, interval=5)` |
396
+ | `max_response_bytes` | cap on a response body (default 32 MiB) |
397
+ | `selling_batch_size` | items per request of the `*_many` selling methods (default 100) |
398
+
399
+ **Injected HTTP clients.** An injected `http_client` serves queries and mutations; the SDK cannot set its timeouts, does not
400
+ close it and trusts it not to resend a request whose connection failed. Every SDK request is sent with
401
+ `follow_redirects=False` and `auth=None` per request, so the client's own redirect policy and `auth` never apply (a
402
+ followed redirect would resend a credential header, and a mutation, to another host). A 3xx answer is an `HttpError` and
403
+ is not retried. TLS verification is always on; there is no switch to turn it off.
404
+
405
+ ## Logging and redaction
406
+
407
+ The SDK logs through the standard `logging` module (logger `whitemarket`, or the one you pass). Request lines, retries and
408
+ reconnects are logged; credentials never are: the `Authorization` and `X-partner-token` headers, `cf_connect` URL
409
+ values, the bodies of `auth_*` and `profile_token_set`, and Steam ids are redacted. The WebSocket libraries log every frame
410
+ at DEBUG; the SDK drops those records of the `centrifuge` and `websockets.client` loggers. Credentials are `Secret` values
411
+ everywhere they are stored or passed. Server error messages and `partial_data` are raw server data.
412
+
413
+ ## Versioning and schema updates
414
+
415
+ The SDK follows [Semantic Versioning](https://semver.org/); while `0.x` a minor release may break the API, and every
416
+ breaking change is listed under "Breaking" in the [changelog](CHANGELOG.md) with `before -> after`.
417
+
418
+ The generated layer follows the partner schema. A GitHub Actions workflow (`schema-sync.yml`) introspects the schema every
419
+ day; when it changed, it regenerates the operations and the client, runs `make check` and opens a pull request on the branch
420
+ `schema-sync/auto` labelled `schema-update` (plus `breaking` when the diff holds breaking changes). The PR carries the
421
+ change summary (`schema/CHANGES.md`); a maintainer decides whether the high-level layer needs changes and which SemVer bump
422
+ applies. Nothing is pushed to `main` directly.
423
+
424
+ ## Examples
425
+
426
+ Runnable scripts in [`examples/`](examples/); run one with `make example NAME=search_market` or
427
+ `python examples/search_market.py`. Everything except the export examples needs `WHITEMARKET_PARTNER_TOKEN`. The scripts that
428
+ move money (`buy_*`, `sell_*`) print a dry run and do nothing without `--yes`. A failure is printed with its class, HTTP status
429
+ and each GraphQL error's category, path and message.
430
+
431
+ | Example | What it does |
432
+ |---|---|
433
+ | `auth_and_ping` | exchange the token, `test_ping` |
434
+ | `search_market` | first page of cheap CS2 listings |
435
+ | `iterate_all_listings` | lazy, bounded walk over listings |
436
+ | `buy_cheapest_by_name` | buy the cheapest listing of an item (reconciliation), `--yes` |
437
+ | `buy_product_by_id` | read a listing, refuse above a max price, buy it by id with a `custom_id`, `--yes` |
438
+ | `track_deal_polling` | wait for a deal by polling every 30 s, prints every status change |
439
+ | `track_deal_live` | the same, woken early by live events |
440
+ | `sell_semi`, `sell_manual` | the two selling flows, `--yes` (assume a seller deal's product id equals the listed product id; not confirmed by the docs) |
441
+ | `export_prices_lookup`, `export_products_stream` | export files, no token |
442
+ | `sse_products_feed`, `ws_products_feed` | five live product events |
443
+ | `ws_personal_deals` | personal deal events (async client) |
444
+ | `raw_generated_operation` | the generated layer and `execute` |
445
+
446
+ ## Documentation
447
+
448
+ - Partner API docs: <https://api.white.market/docs_partner/index.html>
449
+ - SDK specification shared by all WhiteMarket SDKs: [`docs/SDK_SPEC.md`](docs/SDK_SPEC.md)
450
+ - API facts used by the SDK: [`docs/WHITEMARKET_API.md`](docs/WHITEMARKET_API.md)
451
+ - Deviations from the specification: [`docs/DEVIATIONS.md`](docs/DEVIATIONS.md)
452
+
453
+ ## Contributing
454
+
455
+ See [CONTRIBUTING.md](CONTRIBUTING.md): `make check` is the single gate for humans, agents and CI.
456
+
457
+ ## Security
458
+
459
+ See [SECURITY.md](SECURITY.md). Never put a real Partner Token, access token or other credential in an issue, a test or an
460
+ example.
461
+
462
+ ## License
463
+
464
+ MIT, see [LICENSE](LICENSE).