-
Notifications
You must be signed in to change notification settings - Fork 0
/
cod_api.py
55 lines (45 loc) · 2.19 KB
/
cod_api.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import streamlit as st
import pandas as pd
import requests
import json
st.set_page_config(
page_title="CoD Warzone stats - Avocado Team",
page_icon="🔫",
layout="centered",
initial_sidebar_state="auto"
)
def get_friends():
resp_friends = requests.get('https://my.callofduty.com/api/papi-client/codfriends/v1/compendium', cookies=cookies)
friends = resp_friends.json()
st.json(friends)
def get_friends_info():
resp_friends_info = requests.get('https://my.callofduty.com/api/papi-client/stats/cod/v1/title/mw/platform/uno/gamer/iugav/profile/friends/type/wz', cookies=cookies)
friends_info = resp_friends_info.json()
st.json(friends_info)
st.header('CoD Warzone stats')
version = st.selectbox('API version', ['v1', 'v2'])
game = st.selectbox('Game', ['mw', 'wwii', 'boa'])
platform = st.selectbox('Platform', ['uno', 'battle', 'steam'])
username = st.text_input('Username')
mode = st.selectbox('Mode', ['wz', 'mp'])
start = '0' #Useless param - can always remain at 0
end = '0' #UTC timestamp in microseconds, defaults to 0
identity = 'https://www.callofduty.com/api/papi-client/crm/cod/v2/identities'
friends = 'https://my.callofduty.com/api/papi-client/codfriends/v1/compendium'
friends_info = 'https://my.callofduty.com/api/papi-client/stats/cod/v1/title/'+game+'/platform/'+platform+'/gamer/'+username+'/profile/friends/type/'+mode+''
wz_profile = 'https://my.callofduty.com/api/papi-client/stats/cod/v1/title/'+game+'/platform/'+platform+'/gamer/'+username+'/profile/type/'+mode+''
wz_matches = 'https://my.callofduty.com/api/papi-client/crm/cod/v2/title/'+game+'/platform/'+platform+'/gamer/'+username+'/matches/'+mode+'/start/'+start+'/end/'+end+'/details'
sso_token = st.text_input('Enter sso_token')
if sso_token:
cookies = {'ACT_SSO_COOKIE': sso_token}
resp_identity = requests.get(identity, cookies=cookies)
identityData = resp_identity.json()
st.json(identityData)
resp_friends = requests.get(friends, cookies=cookies)
friendsData = resp_friends.json()
st.json(friendsData)
resp_friends_info = requests.get(friends_info, cookies=cookies)
friends_infoData = resp_friends_info.json()
st.json(friends_infoData)
else:
st.write('No data.')