Files
blitz-tools/postwotreplay.py
T

20 lines
743 B
Python
Raw Normal View History

2018-09-30 21:05:51 +08:00
#!/usr/bin/python3
import json, requests, sys, base64
filename = str(sys.argv[1])
2018-10-02 21:04:02 +08:00
#Change this to your own WG id. Find it here: https://api.wotblitz.eu/wotb/account/list/?account_id%2Cnickname
2018-09-30 21:05:51 +08:00
# WG account id of the uploader:
2018-10-02 21:04:02 +08:00
uploader_account_ID = 0
2018-09-30 21:05:51 +08:00
# edit this or use arg.parse() to add proper suppod for commandline arguments
title="Some title"
2018-09-30 22:18:07 +08:00
url='https://wotinspector.com/api/replay/upload?title=' + title + '&details=full&uploaded_by=' + str(uploader_account_ID)
2018-09-30 21:05:51 +08:00
# additional option: 'private=1' to keep the replay way from public listing at WoTinspector.com/replays
with open(filename,'rb') as f:
payload = {'file' : (filename, base64.b64encode(f.read()))}
r = requests.post(url, data=payload)
2018-10-02 14:49:14 +08:00
print(r.json())