example_test.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:overwatch-api 作者: anthok 项目源码 文件源码
def testing(loop):
    # Instantiating the api
    client = AsyncOWAPI()

    data = {}

    # We use our own clientsession to demonstrate that it's possible to pool connections in that way
    async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
        # We await an api method and get a dict back as a result
        # We pass our session, and we pass the platform we want results for, in this case it's PC and we don't actually need to pass, since it's a default
        print('Testing......[get_profile]')
        data[PC] = await client.get_profile("Danielfrogs#2552", session=session, platform=PC)
        print('Testing......[get_profile]')
        data[XBOX] = await client.get_profile("Danielfrogs#2552", session=session, platform=XBOX)
        print('Testing......[get_profile]')
        data[PLAYSTATION] = await client.get_profile("Danielfrogs#2552", session=session, platform=PLAYSTATION)
        print('Testing......[get_stats]')
        data[PC] = await client.get_stats("Danielfrogs#2552", session=session, platform=PC)
        print('Testing......[get_stats]')
        data[XBOX] = await client.get_stats("Danielfrogs#2552", session=session, platform=XBOX)
        print('Testing......[get_stats]')
        data[PC] = await client.get_stats("Danielfrogs#2552", session=session, platform=PLAYSTATION)
        print('Testing......[get_achievements]')
        data[PC] = await client.get_achievements("Danielfrogs#2552", session=session, platform=PC)
        print('Testing......[get_hero_stats]')
        data[PC] = await client.get_hero_stats("Danielfrogs#2552", session=session, platform=PC)

    print(data)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号