Python Forum
Communicating Roblox's Inventory API with python?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Communicating Roblox's Inventory API with python?
#1
Hello,

I am new to python so I dont know how to make http requests.

My goal is to get the json object and covert it to a list.

Roblox Inventory API - https://inventory.roblox.com/docs#!/Inve..._inventory

Url I want to fetch - "https://inventory.roblox.com/v2/users/654357401/inventory?assetTypes=Animation&limit=10&sortOrder=Asc"

Please guide me,
thank you.
Reply
#2
Requests is what you should use in Python for this.
There usually some documentation for an API.
Not looking at doc just using you address can build a requests like this.
import requests

params = {
    'assetTypes': 'Animation',
    'limit': '10',
    'sortOrder': 'Asc',
}

response = requests.get('https://inventory.roblox.com/v2/users/654357401/inventory', params=params)
So if look at response get 403 and the json back that's not authorized,you may have a API key or the requests may now be wrong.
>>> response.status_code
403
>>> 
>>> json_data = response.json()
>>> json_data
{'errors': [{'code': 4,
             'message': "You are not authorized to view this user's inventory.",
             'userFacingMessage': 'Something went wrong'}]}
>>> 
>>> json_data['errors'][0]['message']
"You are not authorized to view this user's inventory."
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Advice for Inventory System Extra 0 1,315 Feb-18-2022, 09:25 PM
Last Post: Extra
  Communicating between programs shubh00 2 1,922 Oct-19-2020, 06:11 AM
Last Post: Gribouillis
  Store a product/item in a inventory program viktoria_linn 1 4,064 Jul-02-2019, 09:26 PM
Last Post: DeaD_EyE
  What area unit the opposite ways in which to understand if an inventory in Python is Smhbugra 2 2,466 May-27-2019, 07:55 PM
Last Post: Larz60+
  Python inventory system with dicts. 2skywalkers 7 5,887 Aug-23-2018, 05:06 PM
Last Post: ichabod801
  Python simple store inventory system. 2skywalkers 3 9,802 Aug-19-2018, 06:12 PM
Last Post: Gribouillis
  Communicating C++ and Python in Jetson TK1 board. hlfan1234567 1 3,174 Jul-09-2017, 04:22 PM
Last Post: hlfan1234567

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020