TypeError: post_request() missing 2 required positional arguments: 'token' and 'uuid'
Question:
So as information I tried to make a script to check if the SessionID is valid in Minecraft and then send it to a webhook.
File "c:UsersPCDesktopRandomShitdhook.py", line 43, in <module>
isValid = post_request()
TypeError: post_request() missing 2 required positional arguments: 'token' and 'uuid'
So this is the code but for some reason it just doesn’t work, I’m pretty new to python and coding in general and need help with this.
from cgitb import text
from dhooks import Webhook, Embed
import requests
import json
hook = Webhook('https://discord.com/api/webhooks/1000036496658669619/OChDQ2Whz86jlIrXDelDUUybjQ0DPXkEWRB9QRInBJb18Ww4W-NPo_ZM_fVwnHQ88gh0')
token = "Token Here"
uuid = "UUID Here"
def send(token, uuid):
#embed json
embed = Embed(
title= "Token Validator",
color=0x68228B,
timestamp='now' # sets the timestamp to current time
)
embed.add_field(name='UUID', value=uuid, inline='false')
embed.add_field(name='Token', value=token, inline='false')
hook.send(embed=embed)
def post_request(token, uuid):
url = "https://sessionserver.mojang.com/session/minecraft/join"
payload = {
"accessToken": token,
"selectedProfile": uuid,
"serverId": uuid
}
headers = {
'Content-Type': "application/json"
}
response = requests.post(url, data=json.dumps(payload), headers=headers)
if response.status_code == 204:
return True
else:
print(response.text)
return False
isValid = post_request()
if isValid:
print("token is valid")
send(token, uuid)
else:
print("token is invalid")
All the help I can get is appreciated.
Answers:
you forgot to pass token, uuid
into the request
function
from cgitb import text
from dhooks import Webhook, Embed
import requests
import json
hook = Webhook('https://discord.com/api/webhooks/1000036496658669619/OChDQ2Whz86jlIrXDelDUUybjQ0DPXkEWRB9QRInBJb18Ww4W-NPo_ZM_fVwnHQ88gh0')
token = "Token Here"
uuid = "UUID Here"
def send(token, uuid):
#embed json
embed = Embed(
title= "Token Validator",
color=0x68228B,
timestamp='now' # sets the timestamp to current time
)
embed.add_field(name='UUID', value=uuid, inline='false')
embed.add_field(name='Token', value=token, inline='false')
hook.send(embed=embed)
def post_request(token, uuid):
url = "https://sessionserver.mojang.com/session/minecraft/join"
payload = {
"accessToken": token,
"selectedProfile": uuid,
"serverId": uuid
}
headers = {
'Content-Type': "application/json"
}
response = requests.post(url, data=json.dumps(payload), headers=headers)
if response.status_code == 204:
return True
else:
print(response.text)
return False
isValid = post_request(token, uuid) # add this here
if isValid:
print("token is valid")
send(token, uuid)
else:
print("token is invalid")
So as information I tried to make a script to check if the SessionID is valid in Minecraft and then send it to a webhook.
File "c:UsersPCDesktopRandomShitdhook.py", line 43, in <module>
isValid = post_request()
TypeError: post_request() missing 2 required positional arguments: 'token' and 'uuid'
So this is the code but for some reason it just doesn’t work, I’m pretty new to python and coding in general and need help with this.
from cgitb import text
from dhooks import Webhook, Embed
import requests
import json
hook = Webhook('https://discord.com/api/webhooks/1000036496658669619/OChDQ2Whz86jlIrXDelDUUybjQ0DPXkEWRB9QRInBJb18Ww4W-NPo_ZM_fVwnHQ88gh0')
token = "Token Here"
uuid = "UUID Here"
def send(token, uuid):
#embed json
embed = Embed(
title= "Token Validator",
color=0x68228B,
timestamp='now' # sets the timestamp to current time
)
embed.add_field(name='UUID', value=uuid, inline='false')
embed.add_field(name='Token', value=token, inline='false')
hook.send(embed=embed)
def post_request(token, uuid):
url = "https://sessionserver.mojang.com/session/minecraft/join"
payload = {
"accessToken": token,
"selectedProfile": uuid,
"serverId": uuid
}
headers = {
'Content-Type': "application/json"
}
response = requests.post(url, data=json.dumps(payload), headers=headers)
if response.status_code == 204:
return True
else:
print(response.text)
return False
isValid = post_request()
if isValid:
print("token is valid")
send(token, uuid)
else:
print("token is invalid")
All the help I can get is appreciated.
you forgot to pass token, uuid
into the request
function
from cgitb import text
from dhooks import Webhook, Embed
import requests
import json
hook = Webhook('https://discord.com/api/webhooks/1000036496658669619/OChDQ2Whz86jlIrXDelDUUybjQ0DPXkEWRB9QRInBJb18Ww4W-NPo_ZM_fVwnHQ88gh0')
token = "Token Here"
uuid = "UUID Here"
def send(token, uuid):
#embed json
embed = Embed(
title= "Token Validator",
color=0x68228B,
timestamp='now' # sets the timestamp to current time
)
embed.add_field(name='UUID', value=uuid, inline='false')
embed.add_field(name='Token', value=token, inline='false')
hook.send(embed=embed)
def post_request(token, uuid):
url = "https://sessionserver.mojang.com/session/minecraft/join"
payload = {
"accessToken": token,
"selectedProfile": uuid,
"serverId": uuid
}
headers = {
'Content-Type': "application/json"
}
response = requests.post(url, data=json.dumps(payload), headers=headers)
if response.status_code == 204:
return True
else:
print(response.text)
return False
isValid = post_request(token, uuid) # add this here
if isValid:
print("token is valid")
send(token, uuid)
else:
print("token is invalid")