Migrating to v2
What's new in v2?
- Asynchronous version of the library
- Ability to send HTTP requests for unimplemented endpoints with
send_request - Better syntax for uploading assets
- Support for new APIs: Memory Store (alpha), Subscriptions, Notifications, Group Join Requests, Assets v2, Experience and User Info, and Restart Servers
- Some new methods to simplifiy certain parts of code
Updating the library
py -3 -m pip install rblx-open-cloud --upgrade
python3 -m pip install rblx-open-cloud --upgrade
Breaking Changes
There are a few breaking changes between v1 and v2 which require changes in existing v1 code to be compatible with v2. This guide will demonstrate all these changes.
Datastore methods renamed
The following methods have had _entry appended to them get, set, increment, remove. For example take the following code:
value, info = datastore.get("287113233")
datastore.remove("287113233")
Would be rewritten as:
value, info = datastore.get_entry("287113233")
datastore.remove_entry("287113233")
Additionally, get_data_store has been renamed to get_datastore, list_data_store has been renamed to list_datastore, and get_ordered_data_store has been renamed to get_ordered_datastore.
upload_place moved and renamed
upload_place has been moved from Experience to Place and renamed to Place.upload_place_file. The following code would be modified from:
experience.upload_place(000000, file)
To this derivative:
place = experience.get_place(000000)
place.upload_place_file(file)
upload_asset and update_asset now returns Operation
To simplify the process of uploading assets, asset upload requests now return an Operation. This means this lengthly code:
asset = creator.upload_asset(...)
if isinstance(asset, rblxopencloud.Asset):
print(asset)
else:
while True:
status = asset.fetch_status()
if status:
print(status)
break
Can be shortened to:
asset = creator.upload_asset(...).wait()
user_id parameter of list_members removed
For simplicity, list_members no longer accepts a user_id parameter. To fetch a specific member of a group, use fetch_member instead.
Exception changes
The following exceptions have been renamed/merged:
rblx_opencloudException->BaseExceptionInvalidKey->HttpExceptionPermissionDenied->ForbiddenServiceUnavailable->HttpExceptionInsufficientScope->HttpExceptionInvalidAsset->InvalidFile
Note that some breaking changes may not be documented. Please report any that are missing.