MCPcopy
hub / github.com/PokemonGoF/PokemonGo-Bot / is_response_valid

Method is_response_valid

pokemongo_bot/api_wrapper.py:183–208  ·  view source on GitHub ↗
(self, result, request_callers)

Source from the content-addressed store, hash-verified

181 return [i.upper() for i in r]
182
183 def is_response_valid(self, result, request_callers):
184 if not result or result is None or not isinstance(result, dict):
185 return False
186
187 if not 'responses' in result or not 'status_code' in result:
188 return False
189
190 if not isinstance(result['responses'], dict):
191 return False
192
193 try:
194 # Permaban symptom is empty response to GET_INVENTORY and status_code = 3
195 if result['status_code'] == 3 and 'GET_INVENTORY' in request_callers and not result['responses'][
196 'GET_INVENTORY']:
197 raise PermaBannedException
198 except KeyError:
199 # Still wrong
200 return False
201
202 # the response can still programatically be valid at this point
203 # but still be wrong. we need to check if the server did sent what we asked it
204 for request_caller in request_callers:
205 if not request_caller in result['responses']:
206 return False
207
208 return True
209
210 def call(self, max_retry=15):
211 request_callers = self._pop_request_callers()

Callers 2

callMethod · 0.95

Calls

no outgoing calls

Tested by 1