I made a Roblox Open Cloud API Wrapper for Python which allows developers to use Python to access Open Cloud. It has 100% API coverage and I plan to add all new Open Cloud additions to the library!
GitHub Repository: https://github.com/treeben77/rblx-open-cloud
Documentation: https://rblx-open-cloud.readthedocs.io/en/latest
Getting Started
-
Install the library using your terminal:
pip install rblx-open-cloud
-
Create an API key from the Creator Dashboard. You can read Managing API Keys if you get stuck.
-
Import the library:
import rblxopencloud
Now, youāve set up the library, and you can start using the API. Below are some examples of some of the APIs.
Examples
Basic Data Store Functionality
The following example shows how to get a data store, and get, set, increment, and remove keys.
# creates a DataStore object from an Experience object using the datastore name and scope.
experience = rblxopencloud.Experience(000000000, api_key="api-key-from-step-2")
datastore = experience.get_data_store("data-store-name", scope="global")
# sets the key 'key-name' to 68 and provides user ids
# DataStore.set does not return the value or an EntryInfo object, instead it returns a EntryVersion object.
datastore.set("key-name", 68, users=[287113233])
# gets the value with the key 'key-name'
# info is a EntryInfo object which contains data like the version code, metadata, userids and timestamps.
value, info = datastore.get("key-name")
# increments the key 'key-name' by 1 and ensures to keep the old users and metadata
# DataStore.increment retuens a value and info pair, just like DataStore.get
value, info = datastore.increment("key-name", 1, users=info.users, metadata=info.metadata)
# deletes the key 'key-name'
datastore.remove("key-name")
If youāre using ordered data stores, use Experience.get_ordered_data_store
instead of Experience.get_data_store
, and remove users
and metadata
parameters. For more advanced uses, like versions, preconditions, etc, read the the documentation here: https://rblx-open-cloud.readthedocs.io/en/latest/datastore/
Publishing Messages with Messaging Service
Currently, you canāt recieve messages, but this is an example to send a message:
experience = rblxopencloud.Experience(000000000, api_key="api-key-from-step-2")
experience.publish_message("topic-name", "example data")
It should be noted that these messages will not be recieved by studio, and dicts are not supported, only strings (this is an open cloud limitation). Hereās an example on how to recieve the message in-game:
local MessagingService = game:GetService("MessagingService")
MessagingService:SubscribeAsync("topic-name", function(message)
print(message.Data)
end)
Uploading Assets
Currently, you may only uploads Decals, Audios, and Models (as fbx). This is a basic example to upload a image to a user or group:
user = rblxopencloud.User(287113233, api_key="api-key-from-step-2")
# or, create a Group object:
group = rblxopencloud.Group(9697297, api_key="api-key-from-step-2")
# this example is for uploading a decal:
with open("path-to/file-object.png", "rb") as file:
asset = user.upload_asset(file, rblxopencloud.AssetType.Decal, "name", "description")
You could make it more complex and make sure the asset has been processed (asset
may be a PendingAsset
sometimes.) For more information, you can look at itās documentation here: https://rblx-open-cloud.readthedocs.io/en/latest/creator/
If youāre using another API like place publishing, you can view examples for them in the examples folder in the repository.
If you find the library useful, please like the DevFroum post, and/or star the GitHub repository! If you need help, feel free to ask here. If youād like to report a bug or request a feature, please use the issue tab on GitHub.