-
What do you want to achieve?
I want to use an API to upload things to roblox preferably using python. -
What is the issue?
The file is sent although I keep getting this error even though its an image
{"Success":false,"Message":"Upload failed. Make sure what you\u0027re uploading is an image."}
-
What solutions have you tried so far?
I’ve tried sending it through data (in python requests) and it doesnt work, and I’ve tried using other apis
Anyway here’s my code.
import requests
cookie = "cookie"
with open('loser.png', 'rb') as f:
#this gets the xcsrf token
getcsrf = requests.post("https://auth.roblox.com/v2/logout", cookies = {".ROBLOSECURITY": cookie})
xcsrf = getcsrf.headers['x-csrf-token']
print(xcsrf)
#sends the request
x = requests.post("https://data.roblox.com/data/upload/json?assetTypeId=2&name=yoo&description=Desc", files={'loser.png': f}, cookies = {".ROBLOSECURITY": cookie}, headers = {"x-csrf-token": xcsrf})
print(x.text)