Welcome to ro.py! ro.py is an asynchronous, object-oriented wrapper for the Roblox web API.
Features
The key features are:
Asynchronous: ro.py works well with asynchronous frameworks like FastAPI and discord.py.
Easy: ro.py’s client-based model is intuitive and easy to learn for both the beginner and expert developer. It
abstracts away API requests and leaves you with simple objects that represent data types on the Roblox platform.
Flexible: ro.py’s builtin Requests object allows the user to do things that we haven’t already implemented
ourselves without dealing with advanced Roblox-specific concepts.
Installation
ro.py is in the process of being completely rewritten for the v2.0 release.
All ro.py releases on PyPI (both the ro-py and roblox packages) are using the v1.2.0.5 release, which is not compatible with the documentation found here.
To install ro.py from PyPI, you can install with pip:
pip install roblox
To install the latest unstable version of ro.py, install git-scm and run the following:
Something else I’ve ought to mention:
ro.py works very well with other asynchronous libraries like discord.py, which means it can be used very easily to create Roblox-to-Discord bots, verification systems, and more! You won’t even need to set up a web server for it.
I’m planning on making a tutorial for this in the future.
It wraps up the Roblox API in a neat little bow that lets you interact with Roblox in Python code.
For example, you could
view information about a user
manage trades
accept join requests
respond to chat messages
hundreds of other actions I can’t be bothered to put here
without ever dealing with an API request yourself.
What might take 5 or 6 API requests to handle in the background can be turned into a piece of Python code that handles everything for you.
tldr: ro.py is a tool for creating bots and other Roblox applications through Python code.
Hey man, I’m just wondering have you found a way to keep the cookies from expiring when logging out? With Roblox’s cookies they expire when you log out of the account, which means if I were to make a group ranking bot I would need to have the ranking account logged in 24/7, I’m trying to find a way around that.
Well the .ROBLOSECURITY cookie does not expire for years, I am assuming it is Roblox that invalidates the session from their end over some time. Try this - implement some logic to request an authticket every now and then and then redeem said authticket for a new cookie.
I suggest logging in and then either deleting the cookie or just using an incognito window and closing the window (which deletes all cookies)
The only reason logging out invalidates a token is because a logout request is sent to their servers. Just removing the cookie will log you out and allow you to use that cookie theoretically forever (as far as we know, they are never invalidated on the server side. the cookie lasts 30 years on the client side.)
Well the thing is I don’t log out, when I close my incognito tab it automatically logs me out. Do you think i can just delete the cookie with editthiscookie and just log me out but not change the cookie?
It doesn’t log you out when you close the incognito window. The cookie is only invalidated if a request is sent to Roblox servers (you must press the logout button)
You should just grab the cookie, put it somewhere, and then close the window. If you grab it and then log out, that cookie’s gone and can’t be used.
Ive used this before but I decided that sending requests to the roblox api using the in-built requests package would be easier for my use case. If this awesome package doesn’t suit you then try using the requests module. But make sure you try out this package for yourself though as the devs put lots of work into it.
The requests module is a blanket module that is used for sending API requests, and isn’t particular to Roblox. If you don’t want to use a library that makes it easier and you want to write general Python code that accesses the API, sure, go with that.
However, ro.py allows you to use the Roblox API without using actual ro.py components, and you can send requests without the extra hassle of ROBLOSECURITY cookies, X-CSRF, and other Roblox API quirks. As an example:
All of these requests will be authenticated and X-CSRF will be handled, which means requests will just be made easier, even if you aren’t using ro.py-specific objects.
Consider this if you don’t feel like using ro.py. (I promise, it’s easier than raw requests!)
This is a great library which is the successor to @iranathan’s robloxapi with a bunch more features,
I’m glad you two teamed up to create this and hopefully you’ll be able to eventually expand to every endpoint!
Glad you like it! We do have plans to implement much more in the future. For some context: ro.py was originally created independently from robloxapi and we merged them later on.
I’ve been using this library to give my Discord bot some more features, and I’m very happy with the result. At first I worried it would take a lot of work to implement this into the code which I already have written, as I am using different cogs and have many commands, but it was extremely easy to implement and get to work with my pre-existing code. The “Getting Started” tutorial was informative and the examples in the documentation were very useful. This is an easy to use, overall great resource which will be useful for many different purposes.
I’m glad you found it helpful! We tried our best to keep ro.py fairly easy to understand while also supporting new features, and it’s nice to know that our work payed off.
I’m also working on a tutorial for specifically Discord-Roblox bots with ro.py, which will release soon. I assume you’re already past that point, given you already have a bot, but it might be a nice read when it does release.