Search code examples
pythonweb-scrapingcookiesroblox

How to set cookies with python


Im attempting to make a python script to login to roblox.com accounts. I was wondering how to set the .ROBLOSECURITY cookie to be able to remotely login to accounts.

I currently do not have any code as I dont know where to start. I am assuming it uses requests though.


Solution

  • If you want to send cookies while using the requests library, set the cookies keyword argument as follows

    import requests
    
    session = requests.Session()
    session.cookies[".ROBLOSECURITY"] = "" // your .ROBLOSECURITY cookie goes here
    
    

    Now if you make a request using the Session, it will include the .ROBLOSECURITY cookie in the headers.