@@ -41,7 +41,7 @@ def get_player_count(self, app_id, timeout=5):
4141 else :
4242 return EResult (resp .eresult )
4343
44- def get_product_info (self , apps = [], packages = [], meta_data_only = False , auto_access_tokens = True , timeout = 15 ):
44+ def get_product_info (self , apps = [], packages = [], meta_data_only = False , raw = False , auto_access_tokens = True , timeout = 15 ):
4545 """Get product info for apps and packages
4646
4747 :param apps: items in the list should be either just ``app_id``, or :class:`dict`
@@ -50,6 +50,8 @@ def get_product_info(self, apps=[], packages=[], meta_data_only=False, auto_acce
5050 :type packages: :class:`list`
5151 :param meta_data_only: only meta data will be returned in the reponse (e.g. change number, missing_token, sha1)
5252 :type meta_data_only: :class:`bool`
53+ :param raw: Data buffer for each app is returned as bytes in its' original form. Apps buffer is text VDF, and package buffer is binary VDF
54+ :type raw: :class:`bool`
5355 :param auto_access_token: automatically request and fill access tokens
5456 :type auto_access_token: :class:`bool`
5557 :return: dict with ``apps`` and ``packages`` containing their info, see example below
@@ -140,7 +142,7 @@ def get_product_info(self, apps=[], packages=[], meta_data_only=False, auto_acce
140142 chunk = chunk [0 ].body
141143
142144 for app in chunk .apps :
143- if app .buffer :
145+ if app .buffer and not raw :
144146 data ['apps' ][app .appid ] = vdf .loads (app .buffer [:- 1 ].decode ('utf-8' , 'replace' ))['appinfo' ]
145147 else :
146148 data ['apps' ][app .appid ] = {}
@@ -150,8 +152,11 @@ def get_product_info(self, apps=[], packages=[], meta_data_only=False, auto_acce
150152 data ['apps' ][app .appid ]['_sha' ] = app .sha
151153 data ['apps' ][app .appid ]['_size' ] = app .size
152154
155+ if app .buffer and raw :
156+ data ['apps' ][app .appid ]['_buffer' ] = app .buffer
157+
153158 for pkg in chunk .packages :
154- if pkg .buffer :
159+ if pkg .buffer and not raw :
155160 data ['packages' ][pkg .packageid ] = vdf .binary_loads (pkg .buffer [4 :]).get (str (pkg .packageid ), {})
156161 else :
157162 data ['packages' ][pkg .packageid ] = {}
@@ -161,6 +166,9 @@ def get_product_info(self, apps=[], packages=[], meta_data_only=False, auto_acce
161166 data ['packages' ][pkg .packageid ]['_sha' ] = pkg .sha
162167 data ['packages' ][pkg .packageid ]['_size' ] = pkg .size
163168
169+ if pkg .buffer and raw :
170+ data ['packages' ][pkg .packageid ]['_buffer' ] = pkg .buffer
171+
164172 if not chunk .response_pending :
165173 break
166174
0 commit comments