steamcom 1.2.43__tar.gz → 1.2.45__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: steamcom
3
- Version: 1.2.43
3
+ Version: 1.2.45
4
4
  Summary: Python implementation of the Steam Community API
5
5
  Project-URL: Homepage, https://github.com/LinarSharifullin/steamcom
6
6
  Author: Linar Sharifullin
@@ -9,7 +9,7 @@ packages = ["/steamcom"]
9
9
  name = "steamcom"
10
10
  description = "Python implementation of the Steam Community API"
11
11
  # The version uploaded to pypi has been changed by action "pypi_publish.yml"
12
- version = "1.2.43"
12
+ version = "1.2.45"
13
13
  authors = [
14
14
  { name="Linar Sharifullin"},
15
15
  ]
@@ -138,9 +138,9 @@ class SteamClient:
138
138
  return int(re.search('\\d+', part_with_currency[0])[0])
139
139
 
140
140
  def get_wallet_info(self) -> WalletInfo:
141
- market_page_response = self.session.get(SteamUrl.COMMUNITY + '/market')
141
+ my_inventory_resposne = self.session.get(SteamUrl.COMMUNITY + '/my/inventory')
142
142
  pattern = r'var g_rgWalletInfo = (\{.*?\});'
143
- match = re.search(pattern, market_page_response.text)
143
+ match = re.search(pattern, my_inventory_resposne.text)
144
144
  if not match:
145
145
  raise ValueError('g_rgWalletInfo not found')
146
146
  raw_wallet_info = json.loads(match.group(1))
@@ -65,37 +65,41 @@ class SteamMarket:
65
65
 
66
66
  @login_required
67
67
  def get_my_market_listings(self, delay: int = 3) -> dict:
68
- response = self.session.get(SteamUrl.COMMUNITY + '/market')
69
- if response.status_code != 200:
70
- text = 'Problem getting the listings. http code: {}'
71
- raise ApiException(text.format(response.status_code))
72
- print('Received market page')
73
- assets_descriptions = json.loads(
74
- text_between(response.text, 'var g_rgAssets = ', ';\n'))
75
- listing_id_to_assets_address = \
76
- get_listing_id_to_assets_address_from_html(response.text)
77
- listings = get_market_listings_from_html(response.text)
78
- listings = merge_items_with_descriptions_from_listing(
79
- listings, listing_id_to_assets_address, assets_descriptions)
80
- listings_end = '<span id="tabContentsMyActiveMarketListings_end">'
81
- listings_total = '<span id="tabContentsMyActiveMarketListings_total">'
82
- if listings_end in response.text:
83
- n_showing = int(text_between(response.text,
84
- listings_end, '</span>'))
85
- n_total = int(text_between(
86
- response.text, listings_total, '</span>').replace(',', ''))
87
- if n_showing < n_total < 1000:
88
- listings_2 = self._parse_listings(n_showing, -1)
89
- print('Received listings')
68
+ # response = self.session.get(SteamUrl.COMMUNITY + '/market')
69
+ # if response.status_code != 200:
70
+ # text = 'Problem getting the listings. http code: {}'
71
+ # raise ApiException(text.format(response.status_code))
72
+ # print('Received market page')
73
+ # assets_descriptions = json.loads(
74
+ # text_between(response.text, 'var g_rgAssets = ', ';\n'))
75
+ # listing_id_to_assets_address = \
76
+ # get_listing_id_to_assets_address_from_html(response.text)
77
+ # listings = get_market_listings_from_html(response.text)
78
+ # listings = merge_items_with_descriptions_from_listing(
79
+ # listings, listing_id_to_assets_address, assets_descriptions)
80
+ # listings_end = '<span id="tabContentsMyActiveMarketListings_end">'
81
+ # listings_total = '<span id="tabContentsMyActiveMarketListings_total">'
82
+ listings = {'sell_listings': {}, 'buy_orders': None}
83
+ url = '{}/market/mylistings/render/?query=&start=0&count=100'\
84
+ .format(SteamUrl.COMMUNITY)
85
+ jresp = api_request(self.session, url)
86
+ listing_id_to_assets_address =\
87
+ get_listing_id_to_assets_address_from_html(
88
+ jresp.get('hovers'))
89
+ listings_2 = get_market_sell_listings_from_api(
90
+ jresp.get('results_html'))
91
+ listings_2 = merge_items_with_descriptions_from_listing(
92
+ listings_2, listing_id_to_assets_address,
93
+ jresp.get('assets'))
94
+ listings['sell_listings'] = listings_2['sell_listings']
95
+ listings_total = jresp['total_count']
96
+ if listings_total > 100:
97
+ for start in range(100, listings_total, 100):
98
+ time.sleep(delay)
99
+ listings_2 = self._parse_listings(start, 100)
100
+ print(f'Received listings {len(listings["sell_listings"])}/{listings_total}')
90
101
  listings['sell_listings']\
91
102
  = listings['sell_listings'] | listings_2
92
- else:
93
- for i in range(0, n_total, 100):
94
- time.sleep(delay)
95
- listings_2 = self._parse_listings(n_showing + i, 100)
96
- print(f'Received listings {i}/{n_total}')
97
- listings['sell_listings']\
98
- = listings['sell_listings'] | listings_2
99
103
  return listings
100
104
 
101
105
  def _parse_listings(self, start: int, count: int) -> dict:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes