-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathfind_user.py
34 lines (26 loc) · 1019 Bytes
/
find_user.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pydest
import asyncio
platforms = {'XBOX': 1, 'PLAYSTATION': 2, 'PC': 3}
async def main():
"""You will need to add your api key!"""
destiny = pydest.Pydest('api-key')
platform = None
while not platform:
user_input = input('Enter your platform (xbox, playstation, or pc): ')
if user_input.upper() in platforms.keys():
platform = platforms.get(user_input.upper())
else:
print('Invalid platform.')
username = input('Enter the username to locate: ')
res = await destiny.api.search_destiny_player(platform, username)
if res['ErrorCode'] == 1 and len(res['Response']) > 0:
print("---")
print("Player found!")
print("Display Name: {}".format(res['Response'][0]['displayName']))
print("Membership ID: {}".format(res['Response'][0]['membershipId']))
else:
print("Could not locate player.")
await destiny.close()
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()