for a, b in zip(list_a, list_b):
...
lst_a = [0.1, 0,1, 0.99, 0.1, 0.99]
lst_b = [0.32, 0.04, 0.98, 0.36, 0.95]
compare_func = lambda a, b: b > 0.9 and a == 0.99
is_similar = all(compare_func(a, b) for a, b in zip(lst_a, lst_b))
import asyncio
import aiohttp
@asyncio.coroutine
def fetch_status(session, url):
status = None
try:
response = yield from session.get(url)
response.close()
status = response.status
except Exception as e:
status = e.__str__()
return status
def run():
session = aiohttp.ClientSession()
with open('domains.txt', mode='r') as f:
for url in f:
url = url.strip()
status = yield from fetch_status(session, url)
print(url, ": ", status, sep='')
session.close()
if __name__ == '__main__':
asyncio.get_event_loop().run_until_complete(run())
class Vehicle(API):
def _call_with_endpoint(self, lang, fields, account_id, endpoint):
if type(fields) is list:
fields = self._format_fields(fields)
return self._api_call(endpoint=endpoint,
fields=fields,
language=lang,
account_id=account_id)
def vehicle_stats(self, lang='ru', fields='', account_id=''):
endpoint = '/tanks/stats/'
return self._call_with_endpoint(lang=lang,
field=fields,
account_id=account_id,
endpoint=endpoint)
def vehicle_achievements(self, lang='ru', fields='', account_id=''):
endpoint = '/tanks/achievements/'
return self._call_with_endpoint(lang=lang,
field=fields,
account_id=account_id,
endpoint=endpoint)