Skip to content

Instantly share code, notes, and snippets.

@dmattera
Last active November 2, 2018 00:22
Show Gist options
  • Save dmattera/8fac6f83908dfea1fc120c17bbeaf5af to your computer and use it in GitHub Desktop.
Save dmattera/8fac6f83908dfea1fc120c17bbeaf5af to your computer and use it in GitHub Desktop.
vpg.py
import requests
import json
refresh_token = """eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU0MzYz
NTI1MCwianRpIjoiNmIxNzM2MGVkYjE2NDExMzhjZWEwMzZmNWE2OTZkM2EiLCJ1c2VyX2lkIjo5Mjg1Mywid
XNlcm5hbWUiOiJTYWludGRvbm92YW4iLCJpc19zdXBlcnVzZXIiOmZhbHNlLCJpc19zdGFmZiI6ZmFsc2UsIm
1hbmFnZXJfdGVhbXMiOltdLCJhc3Npc3RhbnRfdGVhbXMiOltdfQ.Osi73rAT2sRHVtg3f_9Nn3aqVe0uuUzX
zLTxNefEvrw"""
def main():
access_token = get_access_token(refresh_token)
new_xp = 9999
update_profile_xp(access_token, new_xp)
def get_access_token(refresh_token):
url = "https://api.virtualprogaming.com/api/token/refresh/"
headers = {
"Accept": "application/json, text/plain, */*",
"Referer": "http://beta.virtualprogaming.com/",
"Origin": "http://beta.virtualprogaming.com",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36",
"DNT": "1",
"Content-Type": "application/json"
}
payload = {"refresh": refresh_token}
r = requests.post(url, data=json.dumps(payload), headers=headers)
r_json = r.json()
print(r.status_code)
print(r_json)
return r_json["access"]
def update_profile_xp(access_token, new_xp):
save_profile_url = "https://api.virtualprogaming.com/api/profiles/62897/save/"
headers = {
'Accept': 'application/json, text/plain, */*',
'Referer': 'http://beta.virtualprogaming.com/dashboard/my-account',
'Origin': 'http://beta.virtualprogaming.com',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36',
'Authorization': 'Bearer {}'.format(access_token),
'DNT': '1',
'Content-Type': 'application/json'
}
payload = {
"id":62897,
"user":"Saintdonovan",
"avatar":None,
"cover":None,
"bio":"",
"nationality":None,
"xbox":None,
"psn":"saintdonovan",
"steam":None,
"epic":None,
"origin":None,
"xp":new_xp,
"coins":0,
"email_verified":"false",
"phone_verified":"false",
"pants":None,
"shirt":None,
"shoes":None,
"hair":None,
"body":None,
"socks":None
}
r = requests.patch(save_profile_url, json.dumps(payload), headers=headers)
print(r.status_code)
print(r.json())
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment