本文整理汇总了Python中api_wrapper.ApiWrapper.check_awarded_badges方法的典型用法代码示例。如果您正苦于以下问题:Python ApiWrapper.check_awarded_badges方法的具体用法?Python ApiWrapper.check_awarded_badges怎么用?Python ApiWrapper.check_awarded_badges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api_wrapper.ApiWrapper
的用法示例。
在下文中一共展示了ApiWrapper.check_awarded_badges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PokemonGoBot
# 需要导入模块: from api_wrapper import ApiWrapper [as 别名]
# 或者: from api_wrapper.ApiWrapper import check_awarded_badges [as 别名]
#.........这里部分代码省略.........
"No cached Location. Please specify initial location."
)
logger.log(
'[x] Parsing cached location failed, try to use the '
'initial location...'
)
def get_pos_by_name(self, location_name):
# Check if the given location is already a coordinate.
if ',' in location_name:
possible_coordinates = re.findall(
"[-]?\d{1,3}[.]\d{6,7}", location_name
)
if len(possible_coordinates) == 2:
# 2 matches, this must be a coordinate. We'll bypass the Google
# geocode so we keep the exact location.
logger.log(
'[x] Coordinates found in passed in location, '
'not geocoding.'
)
return float(possible_coordinates[0]), float(possible_coordinates[1]), float("0.0")
geolocator = GoogleV3(api_key=self.config.gmapkey)
loc = geolocator.geocode(location_name, timeout=10)
return float(loc.latitude), float(loc.longitude), float(loc.altitude)
def heartbeat(self):
# Remove forts that we can now spin again.
self.fort_timeouts = {id: timeout for id, timeout
in self.fort_timeouts.iteritems()
if timeout >= time.time() * 1000}
self.api.get_player()
self.api.check_awarded_badges()
self.api.call()
self.update_web_location() # updates every tick
def get_inventory_count(self, what):
response_dict = self.get_inventory()
inventory_items = response_dict.get('responses', {}).get('GET_INVENTORY', {}).get(
'inventory_delta', {}).get('inventory_items', {})
if inventory_items:
pokecount = 0
itemcount = 1
for item in inventory_items:
if 'inventory_item_data' in item:
if 'pokemon_data' in item['inventory_item_data']:
pokecount += 1
itemcount += item['inventory_item_data'].get('item', {}).get('count', 0)
if 'pokemon' in what:
return pokecount
if 'item' in what:
return itemcount
return '0'
def get_player_info(self):
response_dict = self.get_inventory()
inventory_items = response_dict.get('responses', {}).get('GET_INVENTORY', {}).get(
'inventory_delta', {}).get('inventory_items', {})
if inventory_items:
pokecount = 0
itemcount = 1
for item in inventory_items:
# print('item {}'.format(item))
playerdata = item.get('inventory_item_data', {}).get('player_stats')
if playerdata: