Getting HTTP code 200 without the request actually being run

Hello everyone

I’m still trying to finally get my autoranker to work, and today i’ve finally been able to achieve HTTP-code 200. However, even tho i get 200, it doesn’t actually execute the action i want it to (in this case ranking an user).

This is my code and “error”:

import json
import requests

global session
session = requests.Session()

session.headers["Content-Type"] = "application/json"
def getToken(robloxsecurity_token):
    session.cookies[".ROBLOSECURITY"] = robloxsecurity_token
    url = "https://auth.roblox.com/v2/logout"
    
    r = session.post(
        url="https://auth.roblox.com/"
    )
    
    session.headers["x-csrf-token"] = r.headers["x-csrf-token"]
    return r
    
    
def setRank(robloxsecurity_token, group_id, user_id, role_id):
    getToken(robloxsecurity_token)
    url = "https://groups.roblox.com/v1/groups/" + str(group_id) + "/users/" + str(user_id)
    
    params = {
    
    "roleId" : role_id
    
    }
    
    r = session.post(
        url="https://auth.roblox.com/",
        params = params
    )
    

    return r

Returned Message:

<Response [200]>
{'cache-control': 'no-cache', 'pragma': 'no-cache', 'content-type': 'application/json; charset=utf-8', 'content-encoding': 'gzip', 'expires': '-1', 'vary': 'Accept-Encoding', 'x-frame-options': 'SAMEORIGIN', 'strict-transport-security': 'max-age=3600', 'roblox-machine-id': 'CHI1-WEB8514', 'p3p': 'CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"', 'date': 'Thu, 07 Jul 2022 20:20:05 GMT', 'content-length': '51', 'report-to': '{"group":"network-errors","max_age":604800,"endpoints":[{"url":"https://ncs.roblox.com/upload"}]}', 'nel': '{"report_to":"network-errors","max_age":604800,"success_fraction":0.001,"failure_fraction":1}'}
{'message': 'OK'}

Thanks in advance for every piece of help!

Surely there’s more code than this as all you’ve given is function definitions?

Yeah I’m importing the script into another and running the function from there

Why not using noblox.js? It handels everything when it comes to authentication. Noblox.js is pretty easy to learn in my opinion.

Sadly not possible because I script in python and noblox is for js

So what does that code look like where you import it?

I’m not a Python developer, but this probably should look like this

def setRank(robloxsecurity_token, group_id, user_id, role_id):
    getToken(robloxsecurity_token)
    url = "https://groups.roblox.com/v1/groups/" + str(group_id) + "/users/" + str(user_id)
    params = {"roleId":role_id}
    # r = session.post(url = "https://auth.roblox.com/", params = params) <- With this line you send the post request to "https://auth.roblox.com/" and not to "https://groups.roblox.com/v1/groups/" + str(group_id) + "/users/" + str(user_id)
    r = session.post(url = url, params = params)
    return r

oh heck yes, i overlooked that, thank you a lot