Inventory api - https://inventory.roblox.com/docs#!/Inventory/get_v2_users_userId_inventory
I want to get the items in inventory of a specific user.
Is there any Roblox API wrapper for python? If not how would I get the data?
Inventory api - https://inventory.roblox.com/docs#!/Inventory/get_v2_users_userId_inventory
I want to get the items in inventory of a specific user.
Is there any Roblox API wrapper for python? If not how would I get the data?
Looks like a Rest API, which means you should be able to just make HTTP calls to it using the HTTPService from inside your roblox game. You dont need a python wrapper for that
Id be mindful of relying on an external API for handling this kind of logic though, Im not sure what ROBLOX’ limits on http traffic are, but I can imagine that there might be some bottlenecking there if you are using it a lot.
You can’t make requests to any Roblox endpoint from a roblox game.
Oh is that possible? I was told that you cannot directly use Roblox API.
Oh, yeah thats what I was thinking.
O whoops! I did not notice it was an internal roblox api. I saw api docs and assumed it was an external API. Thanks for clearing that up!
You can set up a proxy to make requests from Roblox’s API.
Here’s a GitHub repository on how to set up a proxy: GitHub - sentanos/ProxyService
For python, you might use the pycurl module to make and get the request.
import pycurl
from StringIO import StringIO
import json
c = pycurl.Curl()
responseBuffer=StringIO()
userId=1
url="https://inventory.roblox.com/v2/users/"+str(userId)+"/inventory?assetTypes=8&limit=10&sortOrder=Asc"
c.setopt(c.URL,url)
c.setopt(c.WRITEDATA, responseBuffer)
c.perform()
data=json.loads(responseBuffer.getvalue())
if 'errors' in data:
print(data['errors'])
else:
# Do whatever with inventory
Not sure what you mean by a roblox api wrapper for python. The inventory endpoint you’ve given is accessible by any means of a http request, which can be performed like above in various languages, outside of roblox’s engine and platform (client/studio/server).
But developing on the roblox platform, python just isn’t relevant. The engine is written in C++/ Lua, so in these api docs you won’t find any python related wrapper. You will have to use the HttpService, which does have limitations. You’ll need to make a request to some endpoint outside of roblox’s domain, which can perform the http request on your behalf instead. The above resources should cover that.
That is cool! Is there a reason Roblox does not allow requests to their own api?
As I’ve read, it’s to prevent DDoS attacks on their own servers, but this statement was made about 5 years ago. I’m pretty sure tech has advanced and there are several methods to allow us to make requests to their endpoints while preventing possible attacks. However there are many other risks involved such as a kid placing their robloxsecurity token in their game and not securing their scripts, which would lead to their account getting compromised.
Aha, I would also guess that security is the main factor at play here.Thanks for the info