├── .github └── workflows │ └── pythonpublish.yml ├── .gitignore ├── .python-version ├── .travis.yml ├── LICENSE ├── README.md ├── examples └── legacy │ ├── ABTests.py │ ├── instanceGroup.py │ └── login.py ├── pyproject.toml ├── src ├── __init__.py └── webapi │ ├── abtesting.py │ ├── accountInformation.py │ ├── auth.py │ ├── games.py │ ├── groups.py │ ├── privateMessages.py │ ├── users.py │ └── util │ ├── __init__.py │ ├── cached.py │ ├── io.py │ └── req.py └── tests ├── TESTFILE.py └── __init__.py /.github/workflows/pythonpublish.yml: -------------------------------------------------------------------------------- 1 | name: Upload Python Package 2 | on: 3 | release: 4 | types: [created] 5 | jobs: 6 | deploy: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v4.1.1 10 | - name: Setup Python (3.8) 11 | uses: actions/setup-python@v5 12 | with: 13 | python-version: "3.8" 14 | - name: Upgrade Pip, Build, Twine 15 | run: | 16 | python -m pip install --upgrade pip 17 | python -m pip install --upgrade build 18 | python -m pip install twine 19 | - name: Build Source 20 | run: | 21 | python -m build 22 | - name: Publish Source 23 | env: 24 | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} 25 | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} 26 | run: | 27 | twine upload dist/* -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_store 2 | notes.txt 3 | *.pyc 4 | **/__pycache__ 5 | .vscode 6 | .dist -------------------------------------------------------------------------------- /.python-version: -------------------------------------------------------------------------------- 1 | 3.9.4 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # 2 | # .travis.yml 3 | # pyblox 4 | # 5 | 6 | # File is used to test & build to ensure code runablility on the 7 | # various Python versions supported. If a build breaks, we can 8 | # isolate and let developers know ahead of time. 9 | # 10 | # yr. 2021 11 | # 12 | 13 | # General 14 | language: python 15 | python: 16 | 17 | # Stable python version releases 18 | - "3.6" # Default test 19 | - "3.7" 20 | - "3.8" 21 | - "3.9" 22 | 23 | # Most recent python version 24 | - "nightly" 25 | 26 | # PyPy3 27 | - "pypy3" 28 | 29 | # Dev python builds 30 | - "3.6-dev" 31 | - "3.7-dev" 32 | - "3.8-dev" 33 | - "3.9-dev" 34 | install: 35 | - pip3 install --upgrade pip 36 | - pip3 install -r requirements.txt -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024- sbhadr (Sanjay Bhadra) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 |
6 |

7 | 8 | Roblox API Discord 9 | 10 | 11 | GitHub license 12 | 13 |

14 |
15 | 16 | # 17 | 18 | An API wrapper for Roblox written in Python. 19 | 20 | The purpose of this API wrapper is to expose Roblox's API for third party use and/or for individual standalone projects. This is the first stable Python API wrapper for the Roblox API. Documentation can be found within each module. I encourage developers to look into the codebase to better understand this wrapper and what it can truly offer. 21 | 22 | This branch is incredibly unstable but will replace ``master`` once it's stable enough for full release. 23 | This is intended to be ``v3.x.x`` and beyond. Please be aware that there are breaking changes in design 24 | and will not be compatible w/ any versions prior. 25 | 26 | If you would like to contribute, create a pull request with the changes you made. If you have a complaint, issue or problem, create an issue and I will try to answer as fast as I can. 27 | 28 | > **Notice:** Traditional documentation does not exist due to the fact that developers should know what the code does and why it could benefit your project. Please take a look at the library's files for references. In almost all cases, you'll find that the class names match up with the documentation found in the following format: https://APINAME.roblox.com/#docs 29 | 30 | # Requirements 31 | 32 | - Python 3.8+ / 3.8-dev+ or PyPy3 33 | - asyncio 34 | - httpx 35 | - pytest 36 | 37 | > **Notice:** Requirements should be installed automatically via pip. 38 | 39 | # Feature Addition 40 | - Supports an unlimited amount of users 41 | - Supports an unlimited amount of groups 42 | - Supports authentication by cookie 43 | - Supports wide coverage of the API 44 | - Follows the official documentation that Roblox provides 45 | - Handles token-managment for you 46 | 47 | > **Notice:** This does not cover all that Pyblox has to offer just a subset. 48 | 49 | # Compatibility 50 | - Async Compatible (default) 51 | - Supports MacOS, Windows, Linux, Raspbian 52 | - Should be able to work on PyPy3 53 | - Will not work on Python 2.x.x or any version below Python 3.8 54 | - Works with Discord.py & other Python-based discord libraries 55 | - Only works via cookie login; does not support username and password authentication 56 | 57 | > **Disclaimer:** When using any of the authentication features, please do not risk your account. Instead, use an alt or a secondary account to protect your main account and assets that belong to it. 58 | -------------------------------------------------------------------------------- /examples/legacy/ABTests.py: -------------------------------------------------------------------------------- 1 | # 2 | # ABTests.py 3 | # pyblox 4 | # 5 | # By NSG (Nikita Petko) and IvanG (Ivan Gregrovnich) 6 | # Copyright © 2015-2020 MFD. All rights reserved. 7 | # 8 | 9 | from pyblox3 import AbTesting_v1, Auth_v2 10 | import json 11 | import asyncio 12 | 13 | user = Auth_v2(cookies={".ROBLOSECURITY": "Token"}) 14 | abtestapi = AbTesting_v1(auth=user) 15 | 16 | # The SubjectTargetId when using SubjectType "User" is required to match the UserId of the cookie you supplied. 17 | # And if a SINGLE Id doesn't match your UserId, it will throw a 403 18 | 19 | browserTrackerABTests = [ 20 | abtestapi.createGetEnrollmentType(ExperimentName="SomeABTestExperiment", SubjectType=2, SubjectTargetId=1234), 21 | # 2 represents BrowserTracker and is the same as below: 22 | abtestapi.createGetEnrollmentType(ExperimentName="SomeABTestExperiment", 23 | SubjectType="BrowserTracker", 24 | SubjectTargetId=1234), 25 | ] 26 | userABTests = [ 27 | abtestapi.createGetEnrollmentType(ExperimentName="SomeUserABTestExperiment", SubjectType=1, SubjectTargetId=1234), 28 | # 1 represents User and is the same as below: 29 | abtestapi.createGetEnrollmentType(ExperimentName="SomeABTestExperiment", 30 | SubjectType="User", 31 | SubjectTargetId=1234), 32 | ] 33 | 34 | 35 | async def event_loop(): 36 | browserTrackerResponse = await abtestapi.getEnrollments(request=json.dumps(browserTrackerABTests)) 37 | userResponse = await abtestapi.getEnrollments(request=json.dumps(userABTests)) 38 | print(browserTrackerResponse, userResponse) 39 | 40 | 41 | loop = asyncio.get_event_loop() # Get the event loop 42 | loop.run_until_complete(event_loop()) # Bind the your event loop to the main one 43 | -------------------------------------------------------------------------------- /examples/legacy/instanceGroup.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from pyblox3 import Groups_v1 3 | 4 | # Instance your group as a variable 5 | base_group = Groups_v1(groupid="GROUPID") 6 | 7 | 8 | # Standard Event Loop 9 | async def event_loop(): 10 | group_info = await base_group.Membership.get() # Uses the id specified in Base_Group 11 | print(group_info) # Prints group info to console 12 | 13 | # Async stuff, woohoo 14 | loop = asyncio.get_event_loop() 15 | loop.run_until_complete(event_loop()) 16 | loop.close() -------------------------------------------------------------------------------- /examples/legacy/login.py: -------------------------------------------------------------------------------- 1 | # 2 | # examples -> login.py 3 | # pyblox 4 | # 5 | # By sbhadr (Sanjay Bhadra) 6 | # Copyright © 2024- sbhadr (Sanjay Bhadra). All rights reserved. 7 | # THIS DOES NOT WORK. Roblox removed the ability for bots to login traditionally. 8 | # Use an account cookie or opencloud instead. 9 | # 10 | 11 | from pyblox3 import * 12 | import asyncio 13 | 14 | 15 | ''' 16 | A basic example of how to login via Pyblox. Yes, it finally supports async/await protocol. : ) 17 | This is what your 'config.json' should look like inside. 18 | 19 | { 20 | "ctype": "username", 21 | "cvalue": "yourusername", 22 | "password": "yourpassword", 23 | ".ROBLOSECURITY": "Full Cookie found in F12->Application->Left Menu Cookies tab->click the http://www.roblox.com->.ROBLOSECURITY row where it says, "Value" " 24 | } 25 | ''' 26 | 27 | 28 | # Generic Event Loop, put all code inside this method 29 | async def event_loop(): 30 | await Auth_v2.client(file="config.json") # Config file in the same directory as this file 31 | await Groups_v1.Wall.post(groupid=4658962,body="Async Test 1") # Post's "Async Test 1" to your group's wall 32 | 33 | loop = asyncio.get_event_loop() # Get the event loop 34 | loop.run_until_complete(event_loop()) # Bind the your event loop to the main one 35 | loop.close() # Close process when task is finished 36 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["hatchling"] 3 | build-backend = "hatchling.build" 4 | 5 | [project] 6 | name = "pyblox3" 7 | version = "3.0-beta.6" 8 | authors = [ 9 | { name="Sanjay Bhadra", email="sbhadr.github@gmail.com" } 10 | ] 11 | description = "An API wrapper for Roblox written in Python" 12 | readme = "README.md" 13 | license = { file="LICENSE" } 14 | requires-python = ">=3.8" 15 | dependencies = [ 16 | "aiohttp", 17 | "asyncio", 18 | "httpx", 19 | "pytest" 20 | ] 21 | classifiers = [ 22 | "License :: OSI Approved :: MIT License", 23 | "Operating System :: OS Independent", 24 | "Development Status :: 4 - Beta", 25 | "Programming Language :: Python :: 3", 26 | "Programming Language :: Python :: 3.8", 27 | "Programming Language :: Python :: 3.9", 28 | "Programming Language :: Python :: 3.10", 29 | "Programming Language :: Python :: 3.11", 30 | "Programming Language :: Python :: 3.12", 31 | "Programming Language :: Python :: 3.13" 32 | ] 33 | keywords = [ 34 | "Python", "Roblox", "API", "Wrapper", "Library", "Python3", "API-Wrapper", "RobloxDev", 35 | "Roblox-API", "Game Development", "Automation", "Scripting", "HTTP Requests", 36 | "JSON", "Authentication", "User Management", "Asset Management", "Game Analytics", 37 | "Server Communication", "Data Parsing", "Web Scraping", "Multiplayer Games", 38 | "Community Engagement", "Player Data", "Game Sessions", "Inventory Management", "Platform Integration", 39 | "Cloud Services", "Social Features", "Development Tools", "Content Creation", "Security", 40 | "Rate Limiting", "Error Handling", "Open Source", "Collaboration", "Version Control", 41 | "Documentation", "Tutorials", "User Support", "Performance Optimization", "Cross-platform", 42 | "Event Handling", "Asynchronous Programming", "Dependency Management", "Unit Testing", 43 | "Continuous Integration", "Deployment", "Community Contributions", "Licensing" 44 | ] 45 | 46 | [project.urls] 47 | Repository = "https://github.com/RbxAPI/Pyblox/tree/nightly_build" 48 | Issues = "https://github.com/RbxAPI/Pyblox/issues" 49 | Source = "https://github.com/RbxAPI/Pyblox" 50 | Discord = "https://discord.com/invite/EDXNdAT" 51 | 52 | [tool.hatch.build.targets.wheel] 53 | packages = [ 54 | "src", 55 | "pyblox3.webapi", 56 | "pyblox3.webapi.util" 57 | ] -------------------------------------------------------------------------------- /src/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # __init__.py 3 | # pyblox 4 | # 5 | # By sbhadr (Sanjay Bhadra) 6 | # Copyright © 2024- sbhadr (Sanjay Bhadra). All rights reserved. 7 | # 8 | 9 | __title__ = 'pyblox' 10 | __author__ = 'sbhadr' 11 | __version__ = '3.0-beta.6' 12 | __license__ = 'MIT' 13 | __copyright__ = 'Copyright © 2024- sbhadr (Sanjay Bhadra)' 14 | 15 | 16 | # Parent Class Modules 17 | from .webapi.groups import * 18 | from .webapi.users import * 19 | from .webapi.auth import * 20 | from .webapi.abtesting import * 21 | from .webapi.accountInformation import * 22 | from .webapi.privateMessages import * 23 | from .webapi.games import * 24 | 25 | # Utility Modules 26 | from .webapi.util import * -------------------------------------------------------------------------------- /src/webapi/abtesting.py: -------------------------------------------------------------------------------- 1 | # 2 | # abtesting.py 3 | # pyblox 4 | # 5 | # By NSG (Nikita Petko) and IvanG (Ivan Gregrovnich) with sbhadr (Sanjay Bhadra) 6 | # Copyright © 2024- sbhadr with MFD. All rights reserved. 7 | # 8 | 9 | from .util import Req 10 | 11 | root = "https://abtesting.roblox.com" 12 | 13 | Req = Req() 14 | 15 | class AbTesting_v1: 16 | 17 | def __init__(self, **kwargs): 18 | auth = kwargs.get("auth", None) 19 | self.auth = auth.auth_cookies 20 | 21 | # POST : https://abtesting.roblox.com/v1/get-enrollments 22 | # Docs : n/a 23 | async def getEnrollments(self, 24 | **kwargs): 25 | global root 26 | auth = self.auth 27 | request = kwargs.get('request') 28 | response = await Req.request(t='POST', 29 | url=root+'/v1/get-enrollments', 30 | cookies=auth, 31 | payload=request, 32 | header={'Content-Type': 'application/json'}) 33 | if response[0] == 200: 34 | return response[4]['data'] 35 | elif response[0] == 403: 36 | return False, "You are unauthorised to create this request with the credentials you supplied!" 37 | else: 38 | return False, response[4] 39 | 40 | @staticmethod 41 | def createGetEnrollmentType(**kwargs): 42 | ExperimentName = kwargs.get("ExperimentName", None) 43 | SubjectType = kwargs.get("SubjectType", None) 44 | SubjectTargetId = kwargs.get("SubjectTargetId", None) 45 | if len(ExperimentName) == 0 or len(ExperimentName) > 50: 46 | raise SyntaxError("The ExperimentName should not be empty or greater than 50 characters.") 47 | if SubjectTargetId < 1: 48 | raise SyntaxError("In order to satisfy the request, the SubjectTargetId is required to be greater than 0.") 49 | if (type(SubjectType) == int and SubjectType > 2) \ 50 | or (type(SubjectType) == int and SubjectType < 1) \ 51 | or (type(SubjectType) == str and len(SubjectType) == 0): 52 | raise SyntaxError("In order to satisfy the request, the SubjectType is required to 1 or 2 " 53 | "or User or BrowserTracker") 54 | return {'ExperimentName': ExperimentName, 'SubjectType': SubjectType, 'SubjectTargetId': SubjectTargetId} 55 | -------------------------------------------------------------------------------- /src/webapi/accountInformation.py: -------------------------------------------------------------------------------- 1 | # 2 | # accountInformation.py 3 | # pyblox 4 | # 5 | # By sbhadr (Sanjay Bhadra) 6 | # Copyright © 2024- sbhadr (Sanjay Bhadra). All rights reserved. 7 | # 8 | 9 | from .util import Req 10 | 11 | Req = Req() 12 | 13 | class accountInformation_v1: 14 | 15 | def __init__(self,**kwargs): 16 | auth = kwargs.get("auth") 17 | self.auth = auth.auth_cookies 18 | self.Metadata = self.Metadata(self) 19 | self.phoneInformation = self.phoneInformation(self) 20 | self.promotionChannel = self.promotionChannel(self) 21 | self.starCodeAffiliate = self.starCodeAffiliate(self) 22 | self.robloxBadges = self.robloxBadges(self) 23 | self.emailInformation = self.emailInformation(self) 24 | 25 | # GET : https://accountinformation.roblox.com/v1/birthdate 26 | # Docs : https://accountinformation.roblox.com/docs#!/AccountInformation/get_v1_birthdate 27 | async def getBirthdate(self): 28 | auth = self.auth 29 | response = await Req.request(t="GET", url=f'https://accountinformation.roblox.com/v1/birthdate', cookies=auth) 30 | return response[4] 31 | 32 | # POST : https://accountinformation.roblox.com/v1/birthdate 33 | # Docs : https://accountinformation.roblox.com/docs#!/AccountInformation/post_v1_birthdate 34 | async def updateBirthdate(self,**kwargs): 35 | auth = self.auth 36 | request = kwargs.get("request", None) 37 | response = await Req.request(t="POST", url=f'https://accountinformation.roblox.com/v1/birthdate', payload=request, cookies=auth) 38 | if response[0] == 200: 39 | return True 40 | return False, response[4] 41 | 42 | # GET : https://accountinformation.roblox.com/v1/description 43 | # Docs : https://accountinformation.roblox.com/docs#!/AccountInformation/get_v1_description 44 | async def getDescription(self): 45 | auth = self.auth 46 | response = await Req.request(t="GET", url=f'https://accountinformation.roblox.com/v1/description', cookies=auth) 47 | return response[4] 48 | 49 | # POST : https://accountinformation.roblox.com/v1/description 50 | # Docs : https://accountinformation.roblox.com/docs#!/AccountInformation/post_v1_description 51 | async def updateDescription(self,**kwargs): 52 | auth = self.auth 53 | request = kwargs.get("request", None) 54 | response = await Req.request(t="POST", url=f'https://accountinformation.roblox.com/v1/description', payload=request, cookies=auth) 55 | if response[0] == 200: 56 | return True 57 | return False, response[4] 58 | 59 | # GET : https://accountinformation.roblox.com/v1/gender 60 | # Docs : https://accountinformation.roblox.com/docs#!/AccountInformation/get_v1_gender 61 | async def getGender(self): 62 | auth = self.auth 63 | response = await Req.request(t="GET", url=f'https://accountinformation.roblox.com/v1/gender', cookies=auth) 64 | return response[4] 65 | 66 | 67 | # POST : https://accountinformation.roblox.com/v1/gender 68 | # Docs : https://accountinformation.roblox.com/docs#!/AccountInformation/post_v1_gender 69 | async def updateGender(self,**kwargs): 70 | auth = self.auth 71 | request = kwargs.get("request", None) 72 | response = await Req.request(t="POST", url=f'https://accountinformation.roblox.com/v1/gender', payload=request, cookies=auth) 73 | if response[0] == 200: 74 | return True 75 | return False, response[4] 76 | 77 | # GET : https://accountinformation.roblox.com/v1/xbox-live/consecutive-login-days 78 | # Docs : https://accountinformation.roblox.com/docs#!/AccountInformation/get_v1_xbox_live_consecutive_login_days 79 | async def getConsecutiveXboxDays(self): 80 | auth = self.auth 81 | response = await Req.request(t="GET", url=f'https://accountinformation.roblox.com/v1/xbox-live/consecutive-login-days', cookies=auth) 82 | return response[4] 83 | 84 | 85 | class Metadata: 86 | 87 | def __init__(self,accountInformation_v1): 88 | self.accountInformation_v1 = accountInformation_v1 89 | self.auth = accountInformation_v1.auth 90 | 91 | # GET : https://accountinformation.roblox.com/v1/metadata 92 | # Docs : https://accountinformation.roblox.com/docs#!/Metadata/get_v1_metadata 93 | async def get(self): 94 | auth = self.auth 95 | response = await Req.request(t="GET", url=f'https://accountinformation.roblox.com/v1/metadata', cookies=auth) 96 | return response[4] 97 | 98 | 99 | class phoneInformation: 100 | 101 | def __init__(self,accountInformation_v1): 102 | self.accountInformation_v1 = accountInformation_v1 103 | self.auth = accountInformation_v1.auth 104 | 105 | # GET : https://accountinformation.roblox.com/v1/phone 106 | # Docs : https://accountinformation.roblox.com/docs#!/PhoneInformation/get_v1_phone 107 | async def get(self): 108 | auth = self.auth 109 | response = await Req.request(t="GET", url=f'https://accountinformation.roblox.com/v1/phone', cookies=auth) 110 | response[4] 111 | 112 | # POST : https://accountinformation.roblox.com/v1/phone 113 | # Docs : https://accountinformation.roblox.com/docs#!/PhoneInformation/post_v1_phone 114 | async def update(self,**kwargs): 115 | auth = self.auth 116 | request = kwargs.get("request", None) 117 | response = await Req.request(t="POST", url=f'https://accountinformation.roblox.com/v1/phone', payload=request, cookies=auth) 118 | if response[0] == 200: 119 | return True 120 | return False, response[4] 121 | 122 | # POST : https://accountinformation.roblox.com/v1/phone/delete 123 | # Docs : https://accountinformation.roblox.com/docs#!/PhoneInformation/post_v1_phone_delete 124 | async def delete(self,**kwargs): 125 | auth = self.auth 126 | request = kwargs.get("request", None) 127 | response = await Req.request(t="POST", url=f'https://accountinformation.roblox.com/v1/phone/delete', payload=request, cookies=auth) 128 | if response[0] == 200: 129 | return True 130 | return False, response[4] 131 | 132 | # POST : https://accountinformation.roblox.com/v1/phone/resend 133 | # Docs : https://accountinformation.roblox.com/docs#!/PhoneInformation/post_v1_phone_resend 134 | async def resend(self,**kwargs): 135 | auth = self.auth 136 | request = kwargs.get("request", None) 137 | response = await Req.request(t="POST", url=f'https://accountinformation.roblox.com/v1/phone/resend', payload=request, cookies=auth) 138 | if response[0] == 200: 139 | return True 140 | return False, response[4] 141 | 142 | 143 | # POST : https://accountinformation.roblox.com/v1/verify 144 | # Docs : https://accountinformation.roblox.com/docs#!/PhoneInformation/post_v1_phone_verify 145 | async def verify(self,**kwargs): 146 | auth = self.auth 147 | request = kwargs.get("request", None) 148 | response = await Req.request(t="POST", url=f'https://accountinformation.roblox.com/v1/phone/verify', payload=request, cookies=auth) 149 | if response[0] == 200: 150 | return True 151 | return False, response[4] 152 | 153 | 154 | class promotionChannel: 155 | 156 | def __init__(self,accountInformation_v1): 157 | self.accountInformation_v1 = accountInformation_v1 158 | self.auth = accountInformation_v1.auth 159 | 160 | # GET : https://accountinformation.roblox.com/v1/promotion-channels 161 | # Docs : https://accountinformation.roblox.com/docs#!/PromotionChannel/get_v1_promotion_channels 162 | async def get(self): 163 | auth = self.auth 164 | response = await Req.request(t="GET", url=f'https://accountinformation.roblox.com/v1/promotion-channels', cookies=auth) 165 | response[4] 166 | 167 | 168 | # POST : https://accountinformation.roblox.com/v1/promotion-channels 169 | # Docs : https://accountinformation.roblox.com/docs#!/PromotionChannel/post_v1_promotion_channels 170 | async def update(self,**kwargs): 171 | auth = self.auth 172 | request = kwargs.get("request", None) 173 | response = await Req.request(t="POST", url=f'https://accountinformation.roblox.com/v1/promotion-channels', payload=request, cookies=auth) 174 | if response[0] == 200: 175 | return True 176 | return False, response[4] 177 | 178 | # GET : https://accountinformation.roblox.com/v1/users/{userid}/promotion-channels 179 | # Docs : https://accountinformation.roblox.com/docs#!/PromotionChannel/get_v1_users_userId_promotion_channels 180 | async def getFromUser(self,**kwargs): 181 | auth = self.auth 182 | userid = kwargs.get("userid", None) 183 | response = await Req.request(t="GET", url=f'https://accountinformation.roblox.com/v1/user/{userid}/promotion-channels', cookies=auth) 184 | response[4] 185 | 186 | class starCodeAffiliate: 187 | 188 | def __init__(self,accountInformation_v1): 189 | self.accountInformation_v1 = accountInformation_v1 190 | self.auth = accountInformation_v1.auth 191 | 192 | # DELETE : https://accountinformation.roblox.com/v1/star-code-affiliates 193 | # Docs : https://accountinformation.roblox.com/docs#!/StarCodeAffiliate/delete_v1_star_code_affiliates 194 | async def remove(self,**kwargs): 195 | auth = self.auth 196 | response = await Req.request(t="DEL", url=f'https://accountinformation.roblox.com/v1/star-code-affiliates', cookies=auth) 197 | if response[0] == 200: 198 | return True 199 | return False, response[4] 200 | 201 | # GET : https://accountinformation.roblox.com/v1/star-code-affiliates 202 | # Docs : https://accountinformation.roblox.com/docs#!/StarCodeAffiliate/get_v1_star_code_affiliates 203 | async def get(self): 204 | auth = self.auth 205 | response = await Req.request(t="GET", url=f'https://accountinformation.roblox.com/v1/star-code-affiliates', cookies=auth) 206 | response[4] 207 | 208 | # POST : https://accountinformation.roblox.com/v1/star-code-affiliates 209 | # Docs : https://accountinformation.roblox.com/docs#!/StarCodeAffiliate/post_v1_star_code_affiliates 210 | async def add(self,**kwargs): 211 | auth = self.auth 212 | request = kwargs.get("request", None) 213 | response = await Req.request(t="POST", url=f'https://accountinformation.roblox.com/v1/star-code-affiliates', payload=request, cookies=auth) 214 | if response[0] == 200: 215 | return True 216 | return False, response[4] 217 | 218 | 219 | class robloxBadges: 220 | 221 | def __init__(self,accountInformation_v1): 222 | self.accountInformation_v1 = accountInformation_v1 223 | self.auth = accountInformation_v1.auth 224 | 225 | # GET : https://accountinformation.roblox.com/v1/users/{userid}/roblox-badges 226 | # Docs : https://accountinformation.roblox.com/docs#!/RobloxBadges/get_v1_users_userId_roblox_badges 227 | async def getFromUser(self,**kwargs): 228 | auth = self.auth 229 | userid = kwargs.get("userid", None) 230 | response = await Req.request(t="GET", url=f'https://accountinformation.roblox.com/v1/user/{userid}/roblox-badges', cookies=auth) 231 | response[4] 232 | 233 | 234 | class emailInformation: 235 | 236 | def __init__(self,accountInformation_v1): 237 | self.accountInformation_v1 = accountInformation_v1 238 | self.auth = accountInformation_v1.auth 239 | 240 | # POST : https://accountinformation.roblox.com/v1/email/verify 241 | # Docs : https://accountinformation.roblox.com/docs#!/EmailInformation/post_v1_email_verify 242 | async def verify(self,**kwargs): 243 | auth = self.auth 244 | request = kwargs.get("request", None) 245 | response = await Req.request(t="POST", url=f'https://accountinformation.roblox.com/v1/email/verify', payload=request, cookies=auth) 246 | if response[0] == 200: 247 | return True 248 | return False, response[4] -------------------------------------------------------------------------------- /src/webapi/auth.py: -------------------------------------------------------------------------------- 1 | # 2 | # auth.py 3 | # pyblox 4 | # 5 | # By sbhadr (Sanjay Bhadra) 6 | # Copyright © 2024- sbhadr (Sanjay Bhadra). All rights reserved. 7 | # 8 | 9 | root = "https://auth.roblox.com" 10 | 11 | class Auth_v2: 12 | 13 | def __init__(self,**kwargs): 14 | auth_cookies = kwargs.get("cookies") 15 | self.auth_cookies = auth_cookies -------------------------------------------------------------------------------- /src/webapi/games.py: -------------------------------------------------------------------------------- 1 | # 2 | # games.py 3 | # pyblox 4 | # 5 | # By sbhadr (Sanjay Bhadra) 6 | # Copyright © 2024- sbhadr (Sanjay Bhadra). All rights reserved. 7 | # 8 | 9 | from .util import Req 10 | 11 | Req = Req() 12 | 13 | class Games_v1: 14 | 15 | def __init__(self, **kwargs): 16 | auth = kwargs.get("auth", None) 17 | self.auth = auth.auth_cookies 18 | self.Favorites = self.Favorites(self) 19 | self.GamePasses = self.GamePasses(self) 20 | self.Votes = self.Votes(self) 21 | self.VipServers = self.VipServers(self) 22 | 23 | # GET : "https://games.roblox.com/v1/games" 24 | # Docs : https://games.roblox.com/docs#!/Games/get_v1_games 25 | async def get(self): 26 | auth = self.auth 27 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games', cookies=auth) 28 | return response[4] 29 | 30 | # GET : "https://games.roblox.com/v1/games/{placeId}/servers/{serverType}" 31 | # Docs : https://games.roblox.com/docs#!/Games/get_v1_games_placeId_servers_serverType 32 | async def getServers(self,**kwargs): 33 | auth = self.auth 34 | placeId = kwargs.get("placeId", None) 35 | serverType = kwargs.get("serverType", None) 36 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games/{placeId}/servers/{serverType}', cookies=auth) 37 | return response[4] 38 | 39 | # GET : "https://games.roblox.com/v1/games/games-product-info" 40 | # Docs : https://games.roblox.com/docs#!/Games/get_v1_games_games_product_info 41 | async def getProductInfoList(self): 42 | auth = self.auth 43 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games/games-product-info', cookies=auth) 44 | return response[4] 45 | 46 | # GET : "https://games.roblox.com/v1/games/list" 47 | # Docs : https://games.roblox.com/docs#!/Games/get_v1_games_list 48 | async def getGamesList(self): 49 | auth = self.auth 50 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games/list', cookies=auth) 51 | return response[4] 52 | 53 | # GET : "https://games.roblox.com/v1/games/list-spotlight" 54 | # Docs : https://games.roblox.com/docs#!/Games/get_v1_games_list_spotlight 55 | async def getGamesListSpotlight(self): 56 | auth = self.auth 57 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games/list-spotlight', cookies=auth) 58 | return response[4] 59 | 60 | # GET : "https://games.roblox.com/v1/games/multiget-place-details" 61 | # Docs : https://games.roblox.com/docs#!/Games/get_v1_games_multiget_place_details 62 | async def getMuliPlaceDetails(self): 63 | auth = self.auth 64 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games/multiget-place-details', cookies=auth) 65 | return response[4] 66 | 67 | # GET : "https://games.roblox.com/v1/games/multiget-playability-status" 68 | # Docs : https://games.roblox.com/docs#!/Games/get_v1_games_multiget_playability_status 69 | async def getMuliPlaceDetails(self): 70 | auth = self.auth 71 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games/multiget-playability-status', cookies=auth) 72 | return response[4] 73 | 74 | # GET : "https://games.roblox.com/v1/games/recommendations/algorithm/{algorithmName}" 75 | # Docs : https://games.roblox.com/docs#!/Games/get_v1_games_recommendations_algorithm_algorithmName 76 | async def getGameRecommendations(self,**kwargs): 77 | auth = self.auth 78 | algorithmName = kwargs.get("algorithmName", None) 79 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games/recommendations/algorithm/{algorithmName}', cookies=auth) 80 | return response[4] 81 | 82 | # GET : "https://games.roblox.com/v1/games/recommendations/game/{universeId}" 83 | # Docs : https://games.roblox.com/docs#!/Games/get_v1_games_recommendations_game_universeId 84 | async def getGameRecommendationByUniverse(self,**kwargs): 85 | auth = self.auth 86 | universeId = kwargs.get("universeId", None) 87 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games/recommendations/game/{universeId}', cookies=auth) 88 | return response[4] 89 | 90 | # GET : "https://games.roblox.com/v1/games/sorts" 91 | # Docs : https://games.roblox.com/docs#!/Games/get_v1_games_sorts 92 | async def getOrderedListSorts(self,**kwargs): 93 | auth = self.auth 94 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games/sorts', cookies=auth) 95 | return response[4] 96 | 97 | 98 | class Favorites: 99 | 100 | def __init__(self,Games_v1): 101 | self.Games_v1 = Games_v1 102 | self.auth = Games_v1.auth 103 | 104 | # GET : "https://games.roblox.com/v1/games/{universeId}/favorites" 105 | # Docs : https://games.roblox.com/docs#!/Favorites/get_v1_games_universeId_favorites 106 | async def getbyUniverse(self,**kwargs): 107 | auth = self.auth 108 | universeId = kwargs.get("universeId", None) 109 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games/{universeId}/favorites', cookies=auth) 110 | return response[4] 111 | 112 | # POST : "https://games.roblox.com/v1/games/{universeId}/favorites" 113 | # Docs : https://games.roblox.com/docs#!/Favorites/post_v1_games_universeId_favorites 114 | async def mark(self,**kwargs): 115 | auth = self.auth 116 | universeId = kwargs.get("universeId", None) 117 | request = kwargs.get("request", None) 118 | response = await Req.request(t="POST", url=f'https://games.roblox.com/v1/games/{universeId}/favorites', payload=request, cookies=auth) 119 | if response[0] == 200: 120 | return True 121 | return False, response[4] 122 | 123 | # GET : "https://games.roblox.com/v1/games/{universeId}/favorites/count" 124 | # Docs : https://games.roblox.com/docs#!/Favorites/get_v1_games_universeId_favorites_count 125 | async def getCountbyUniverse(self,**kwargs): 126 | auth = self.auth 127 | universeId = kwargs.get("universeId", None) 128 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games/{universeId}/favorites/count', cookies=auth) 129 | return response[4] 130 | 131 | 132 | class GamePasses: 133 | 134 | def __init__(self,Games_v1): 135 | self.Games_v1 = Games_v1 136 | self.auth = Games_v1.auth 137 | 138 | # GET : "https://games.roblox.com/v1/games/{universeId}/game-passes" 139 | # Docs : https://games.roblox.com/docs#!/GamePasses/get_v1_games_universeId_game_passes 140 | async def getByUniverse(self,**kwargs): 141 | auth = self.auth 142 | universeId = kwargs.get("universeId", None) 143 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games/{universeId}/game-passes', cookies=auth) 144 | return response[4] 145 | 146 | class Votes: 147 | 148 | def __init__(self,Games_v1): 149 | self.Games_v1 = Games_v1 150 | self.auth = Games_v1.auth 151 | 152 | # GET : "https://games.roblox.com/v1/games/{universeId}/votes/user" 153 | # Docs : https://games.roblox.com/docs#!/Votes/get_v1_games_universeId_votes_user 154 | async def getByUniverse(self,**kwargs): 155 | auth = self.auth 156 | universeId = kwargs.get("universeId", None) 157 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games/{universeId}/votes/user', cookies=auth) 158 | return response[4] 159 | 160 | # GET : "https://games.roblox.com/v1/games/votes" 161 | # Docs : https://games.roblox.com/docs#!/Votes/get_v1_games_votes 162 | async def getVotes(self,**kwargs): 163 | auth = self.auth 164 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/games/votes', cookies=auth) 165 | return response[4] 166 | 167 | # PATCH : "https://games.roblox.com/v1/games/{universeId}/user-votes" 168 | # Docs : https://games.roblox.com/docs#!/Votes/patch_v1_games_universeId_user_votes 169 | async def cast(self,**kwargs): 170 | auth = self.auth 171 | universeId = kwargs.get("universeId", None) 172 | requestBody = kwargs.get("requestBody", None) 173 | response = await Req.request(t="PATCH", url=f'https://games.roblox.com/v1/games/{universeId}/user-votes', payload=requestBody, cookies=auth) 174 | if response[0] == 200: 175 | return True 176 | return False, response[4] 177 | 178 | class VipServers: 179 | 180 | def __init__(self,Games_v1): 181 | self.Games_v1 = Games_v1 182 | self.auth = Games_v1.auth 183 | 184 | # GET : "https://games.roblox.com/v1/vip-server/can-invite/{userId}" 185 | # Docs : https://games.roblox.com/docs#!/VipServers/get_v1_vip_server_can_invite_userId 186 | async def canJoin(self,**kwargs): 187 | auth = self.auth 188 | userId = kwargs.get("userId", None) 189 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/vip-server/can-invite/{userId}', cookies=auth) 190 | return response[4] 191 | 192 | # GET : "https://games.roblox.com/v1/vip-servers/{id}" 193 | # Docs : https://games.roblox.com/docs#!/VipServers/get_v1_vip_servers_id 194 | async def get(self,**kwargs): 195 | auth = self.auth 196 | id = kwargs.get("id", None) 197 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v1/vip-servers/{id}', cookies=auth) 198 | return response[4] 199 | 200 | # PATCH : "https://games.roblox.com/v1/vip-servers/{id}" 201 | # Docs : https://games.roblox.com/docs#!/VipServers/patch_v1_vip_servers_id 202 | async def update(self,**kwargs): 203 | auth = self.auth 204 | id = kwargs.get("id", None) 205 | request = kwargs.get("request", None) 206 | response = await Req.request(t="PATCH", url=f'https://games.roblox.com/v1/vip-servers/{id}', payload=request, cookies=auth) 207 | if response[0] == 200: 208 | return True 209 | return False, response[4] 210 | 211 | # POST : "https://games.roblox.com/v1/games/vip-servers/{universeId}" 212 | # Docs : https://games.roblox.com/docs#!/VipServers/post_v1_games_vip_servers_universeId 213 | async def create(self,**kwargs): 214 | auth = self.auth 215 | universeId = kwargs.get("universeId", None) 216 | requestBody = kwargs.get("requestBody", None) 217 | response = await Req.request(t="POST", url=f'https://games.roblox.com/v1/games/vip-servers/{universeId}', payload=requestBody, cookies=auth) 218 | if response[0] == 200: 219 | return True 220 | return False, response[4] 221 | 222 | # PATCH : "https://games.roblox.com/v1/vip-servers/{id}/permissions" 223 | # Docs : https://games.roblox.com/docs#!/VipServers/patch_v1_vip_servers_id_permissions 224 | async def updatePermissions(self,**kwargs): 225 | auth = self.auth 226 | id = kwargs.get("id", None) 227 | request = kwargs.get("request", None) 228 | response = await Req.request(t="PATCH", url=f'https://games.roblox.com/v1/vip-servers/{id}/permissions', payload=request, cookies=auth) 229 | if response[0] == 200: 230 | return True 231 | return False, response[4] 232 | 233 | # PATCH : "https://games.roblox.com/v1/vip-servers/{id}/subscription" 234 | # Docs : https://games.roblox.com/docs#!/VipServers/patch_v1_vip_servers_id_subscription 235 | async def updateSubscriptionStatus(self,**kwargs): 236 | auth = self.auth 237 | id = kwargs.get("id", None) 238 | request = kwargs.get("request", None) 239 | response = await Req.request(t="PATCH", url=f'https://games.roblox.com/v1/vip-servers/{id}/subscription', payload=request, cookies=auth) 240 | if response[0] == 200: 241 | return True 242 | return False, response[4] 243 | 244 | class Games_v2: 245 | 246 | def __init__(self, **kwargs): 247 | auth = kwargs.get("auth", None) 248 | 249 | # GET : "https://games.roblox.com/v2/games/{universeId}/media" 250 | # Docs : https://games.roblox.com/docs#!/Games/get_v2_games_universeId_media 251 | async def getMediaData(self,**kwargs): 252 | auth = self.auth 253 | universeId = kwargs.get("universeId", None) 254 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v2/games/{universeId}/media', cookies=auth) 255 | return response[4] 256 | 257 | # GET : "https://games.roblox.com/v2/groups/{groupId}/games" 258 | # Docs : https://games.roblox.com/docs#!/Games/get_v2_groups_groupId_games 259 | async def getCreatedByGroup(self,**kwargs): 260 | auth = self.auth 261 | groupId = kwargs.get("groupId", None) 262 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v2/groups/{groupId}/games', cookies=auth) 263 | return response[4] 264 | 265 | # GET : "https://games.roblox.com/v2/groups/{groupId}/gamesV2" 266 | # Docs : https://games.roblox.com/docs#!/Games/get_v2_groups_groupId_gamesV2 267 | async def getCreatedByGroupV2(self,**kwargs): 268 | auth = self.auth 269 | groupId = kwargs.get("groupId", None) 270 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v2/groups/{groupId}/gamesV2', cookies=auth) 271 | return response[4] 272 | 273 | # GET : "https://games.roblox.com/v2/users/{userId}/favorite/games" 274 | # Docs : https://games.roblox.com/docs#!/Games/get_v2_users_userId_favorite_games 275 | async def getFavoriteByUser(self,**kwargs): 276 | auth = self.auth 277 | userId = kwargs.get("userId", None) 278 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v2/users/{userId}/favorite/games', cookies=auth) 279 | return response[4] 280 | 281 | # GET : "https://games.roblox.com/v2/users/{userId}/games" 282 | # Docs : https://games.roblox.com/docs#!/Games/get_v2_users_userId_games 283 | async def getCreatedByUser(self,**kwargs): 284 | auth = self.auth 285 | userId = kwargs.get("userId", None) 286 | response = await Req.request(t="GET", url=f'https://games.roblox.com/v2/users/{userId}/games', cookies=auth) 287 | return response[4] -------------------------------------------------------------------------------- /src/webapi/groups.py: -------------------------------------------------------------------------------- 1 | # 2 | # groups.py 3 | # pyblox 4 | # 5 | # By sbhadr (Sanjay Bhadra) 6 | # Copyright © 2024- sbhadr (Sanjay Bhadra). All rights reserved. 7 | # 8 | 9 | from .util import Req 10 | 11 | Req = Req() 12 | 13 | class Groups_v1: 14 | 15 | def __init__(self,**kwargs): 16 | groupid = kwargs.get("groupid", None) 17 | auth = kwargs.get("auth", None) 18 | self.groupid = groupid 19 | self.auth = auth.auth_cookies 20 | self.Membership = self.Membership(self) 21 | self.Revenue = self.Revenue(self) 22 | self.Relationships = self.Relationships(self) 23 | self.Permissions = self.Permissions(self) 24 | self.socialLinks = self.socialLinks(self) 25 | self.Wall = self.Wall(self) 26 | self.Roles = self.Roles(self) 27 | self.primaryGroup = self.primaryGroup(self) 28 | self.roleSets = self.roleSets(self) 29 | 30 | # GET : "https://groups.roblox.com/v1/groups/{grouid}" 31 | # Docs : https://groups.roblox.com/docs#!/Groups/get_v1_groups_groupId 32 | async def get(self): 33 | groupid = self.groupid 34 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}') 35 | return response[4] 36 | 37 | # GET : "https://groups.roblox.com/v1/groups/{groupid}/audit-log" 38 | # Docs : https://groups.roblox.com/docs#!/Groups/get_v1_groups_groupId_audit_log 39 | async def auditLog(self,**kwargs): 40 | groupid = self.groupid 41 | auth = self.auth 42 | actionType = kwargs.get("ActionType", None) # not used 43 | sortOrder = kwargs.get("sortOrder", None) # not used 44 | limit = kwargs.get("limit", None) # not used 45 | cursor = kwargs.get("cursor", None) # not used 46 | userid = kwargs.get('userid', None) # not used 47 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/audit-log', cookies=auth) 48 | return response[4] 49 | 50 | # GET : "https://groups.roblox.com/v1/groups/{groupid}/settings" 51 | # Docs : https://groups.roblox.com/docs#!/Groups/get_v1_groups_groupId_settings 52 | async def settings(self): 53 | groupid = self.groupid 54 | auth = self.auth 55 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/settings', cookies=auth) 56 | return response[4] 57 | 58 | # PATCH : "https://groups.roblox.com/v1/groups/{groupid}/settings" 59 | # Docs : https://groups.roblox.com/docs#!/Groups/patch_v1_groups_groupId_settings 60 | async def updateSettings(self,**kwargs): 61 | groupid = self.groupid 62 | auth = self.auth 63 | request = kwargs.get("request", None) 64 | response = await Req.request(t="PATCH", url=f'https://groups.roblox.com/v1/groups/{groupid}/settings', payload=request, cookies=auth) 65 | if response[0] == 200: 66 | return True 67 | else: 68 | return False, response[4] 69 | 70 | # GET : "https://groups.roblox.com/v1/groups/configuration/metadata" 71 | # Docs : https://groups.roblox.com/docs#!/Groups/get_v1_groups_configuration_metadata 72 | async def configMetadata(self): 73 | response = await Req.request(t="GET", url='https://groups.roblox.com/v1/groups/configuration/metadata') 74 | return response[4] 75 | 76 | # GET : "https://groups.roblox.com/v1/groups/metadata" 77 | # Docs : https://groups.roblox.com/docs#!/Groups/get_v1_groups_metadata 78 | async def metadata(self): 79 | response = await Req.request(t="GET", url='https://groups.roblox.com/v1/groups/metadata') 80 | return response[4] 81 | 82 | # POST : "https://groups.roblox.com/v1/groups/create" 83 | # Docs : https://groups.roblox.com/docs#!/Groups/post_v1_groups_create 84 | async def create(self,**kwargs): 85 | auth = self.auth 86 | request = kwargs.get("request") 87 | response = await Req.request(t="POST", url='https://groups.roblox.com/v1/groups/create', payload=request, cookies=auth) 88 | return response[4] 89 | 90 | # PATCH : "https://groups.roblox.com/v1/groups/{groupid}/description" 91 | # Docs : https://groups.roblox.com/docs#!/Groups/patch_v1_groups_groupId_description 92 | async def updateDescription(self,**kwargs): 93 | groupid = self.groupid 94 | auth = self.auth 95 | request = kwargs.get("request", None) 96 | response = await Req.request(t="PATCH", url=f'https://groups.roblox.com/v1/groups/{groupid}/description', payload=request, cookies=auth) 97 | if response[0] == 200: 98 | return True 99 | else: 100 | return False, response[4] 101 | 102 | # PATCH : "https://groups.roblox.com/v1/groups/{groupid}/status" 103 | # Docs : https://groups.roblox.com/docs#!/Groups/patch_v1_groups_groupId_status 104 | async def updateStatus(self,**kwargs): 105 | groupid = self.groupid 106 | auth = self.auth 107 | statusRequest = kwargs.get("statusRequest", None) 108 | response = await Req.request(t="PATCH", url=f'https://groups.roblox.com/v1/groups/{groupid}/status', payload=statusRequest, cookies=auth) 109 | if response[0] == 200: 110 | return True 111 | else: 112 | return False, response[4] 113 | 114 | # PATCH : "https://groups.roblox.com/v1/groups/icon" 115 | # Docs : https://groups.roblox.com/docs#!/Groups/patch_v1_groups_icon 116 | async def updateIcon(self,**kwargs): 117 | groupid = self.groupid 118 | auth = self.auth 119 | files = kwargs.get("files", None) 120 | response = await Req.request(t="PATCH", url='https://groups.roblox.com/v1/groups/icon', payload={"groupid": groupid,"files": files}, cookies=auth) 121 | if response[0] == 200: 122 | return True 123 | else: 124 | return False, response[4] 125 | 126 | class Membership: 127 | 128 | def __init__(self,Groups_v1): 129 | self.Groups_v1 = Groups_v1 130 | self.groupid = Groups_v1.groupid 131 | self.auth = Groups_v1.auth 132 | 133 | # DELETE : "https://groups.roblox.com/v1/groups/{groupid}/join-requests" 134 | # Docs : https://groups.roblox.com/docs#!/Membership/delete_v1_groups_groupId_join_requests 135 | async def denyJoinRequests(self,**kwargs): 136 | groupid = self.groupid 137 | auth = self.auth 138 | request = kwargs.get("request", None) 139 | response = await Req.request(t="DEL", url=f'https://groups.roblox.com/v1/groups/{groupid}/join-requests', payload=request, cookies=auth) 140 | if response[0] == 200: 141 | return True 142 | else: 143 | return False, response[4] 144 | 145 | # GET : "https://groups.roblox.com/v1/groups/{groupid}/join-requests" 146 | # Docs : https://groups.roblox.com/docs#!/Membership/get_v1_groups_groupId_join_requests 147 | async def getJoinRequests(self,**kwargs): 148 | groupid = self.groupid 149 | auth = self.auth 150 | sortOrder = kwargs.get("sortOrder", None) # Not used yet 151 | limit = kwargs.get("limit", None) # Not used yet 152 | cursor = kwargs.get("cursor", None) # Not used yet 153 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/join-requests', cookies=auth) 154 | return response[4] 155 | 156 | # POST : "https://groups.roblox.com/v1/groups/{groupid}/join-requests" 157 | # Docs : https://groups.roblox.com/docs#!/Membership/post_v1_groups_groupId_join_requests 158 | async def acceptJoinRequests(self,**kwargs): 159 | groupid = self.groupid 160 | auth = self.auth 161 | request = kwargs.get("request", None) 162 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v1/groups/{groupid}/join-requests', payload=request, cookies=auth) 163 | if response[0] == 200: 164 | return True 165 | else: 166 | return False, response[4] 167 | 168 | # DELETE : "https://groups.roblox.com/v1/groups/{groupid}/join-requests/users/{userid}" 169 | # Docs : https://groups.roblox.com/docs#!/Membership/delete_v1_groups_groupId_join_requests_users_userId 170 | async def denyJoinRequest(self,**kwargs): 171 | groupid = self.groupid 172 | auth = self.auth 173 | userid = kwargs.get("userid", None) 174 | response = await Req.request(t="DEL", url=f'https://groups.roblox.com/v1/groups/{groupid}/join-requests/users/{userid}', cookies=auth) 175 | if response[0] == 200: 176 | return True 177 | else: 178 | return False, response[4] 179 | 180 | # GET : "https://groups.roblox.com/v1/groups/{groupid}/join-requests/users/{userid}" 181 | # Docs : https://groups.roblox.com/docs#!/Membership/get_v1_groups_groupId_join_requests_users_userId 182 | async def getJoinRequest(self,**kwargs): 183 | groupid = self.groupid 184 | auth = self.auth 185 | userid = kwargs.get("userid", None) 186 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/join-requests/users/{userid}', cookies=auth) 187 | return response[4] 188 | 189 | # POST : "https://groups.roblox.com/v1/groups/{groupid}/join-requests/users/{userid}" 190 | # Docs : https://groups.roblox.com/docs#!/Membership/post_v1_groups_groupId_join_requests_users_userId 191 | async def acceptJoinRequest(self,**kwargs): 192 | groupid = self.groupid 193 | auth = self.auth 194 | userid = kwargs.get("userid", None) 195 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v1/groups/{groupid}/join-requests/users/{userid}', cookies=auth) 196 | if response[0] == 200: 197 | return True 198 | else: 199 | return False, response[4] 200 | 201 | # GET : "https://groups.roblox.com/v1/groups/{groupid}/membership" 202 | # Docs : https://groups.roblox.com/docs#!/Membership/get_v1_groups_groupId_membership 203 | async def get(self): 204 | groupid = self.groupid 205 | auth = self.auth 206 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/membership', cookies=auth) 207 | return response[4] 208 | 209 | # GET : "https://groups.roblox.com/v1/groups/{groupid}/roles" 210 | # Docs : https://groups.roblox.com/docs#!/Membership/get_v1_groups_groupId_roles 211 | async def roles(self): 212 | groupid = self.groupid 213 | auth = self.auth 214 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/roles', cookies=auth) 215 | return response[4] 216 | 217 | # GET : "https://groups.roblox.com/v1/groups/{groupid}/roles/{roleSetId}/users" 218 | # Docs : https://groups.roblox.com/docs#!/Membership/get_v1_groups_groupId_roles_roleSetId_users 219 | async def rolesetIndex(self,**kwargs): 220 | groupid = self.groupid 221 | auth = self.auth 222 | roleSetId = kwargs.get("roleSetId", None) 223 | sortOrder = kwargs.get("sortOrder", None) # Not used yet 224 | limit = kwargs.get("limit", None) # Not used yet 225 | cursor = kwargs.get("cursor", None) # Not used yet 226 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/roles/{roleSetId}/users', cookies=auth) 227 | return response[4] 228 | 229 | # GET : "https://groups.roblox.com/v1/groups/{groupid}/users" 230 | # Docs : https://groups.roblox.com/docs#!/Membership/get_v1_groups_groupId_users 231 | async def userIndex(self,**kwargs): 232 | groupid = self.groupid 233 | auth = self.auth 234 | sortOrder = kwargs.get("sortOrder", None) # Not used yet 235 | limit = kwargs.get("limit", None) # Not used yet 236 | cursor = kwargs.get("cursor", None) # Not used yet 237 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/users', cookies=auth) 238 | return response[4] 239 | 240 | # POST : "https://groups.roblox.com/v1/groups/{groupid}/users" 241 | # Docs : https://groups.roblox.com/docs#!/Membership/post_v1_groups_groupId_users 242 | async def join(self,**kwargs): 243 | groupid = self.groupid 244 | auth = self.auth 245 | joinGroupModel = kwargs.get("joinGroupModel", None) 246 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v1/groups/{groupid}/users', payload=joinGroupModel, cookies=auth) 247 | if response[0] == 200: 248 | return True 249 | else: 250 | return False, response[4] 251 | 252 | # GET : "https://groups.roblox.com/v1/user/groups/pending" 253 | # Docs : https://groups.roblox.com/docs#!/Membership/get_v1_user_groups_pending 254 | async def pendingIndex(self): 255 | auth = self.auth 256 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/user/groups/pending', cookies=auth) 257 | return response[4] 258 | 259 | # GET : "https://groups.roblox.com/v1/users/{userid}/group-membership-status" 260 | # Docs : https://groups.roblox.com/docs#!/Membership/get_v1_users_userId_group_membership_status 261 | async def status(self,**kwargs): 262 | auth = self.auth 263 | userid = kwargs.get("userid", None) 264 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/users/{userid}/group-membership-status', cookies=auth) 265 | return response[4] 266 | 267 | # GET : "https://groups.roblox.com/v1/users/{userid}/group/roles" 268 | # Docs : https://groups.roblox.com/docs#!/Membership/get_v1_users_userId_groups_roles 269 | async def rolesIndex(self,**kwargs): 270 | auth = self.auth 271 | userid = kwargs.get("userid", None) 272 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/users/{userid}/group/roles', cookies=auth) 273 | return response[4] 274 | 275 | # POST : "https://groups.roblox.com/v1/groups/{groupid}/change-owner" 276 | # Docs : https://groups.roblox.com/docs#!/Membership/post_v1_groups_groupId_change_owner 277 | async def newOwner(self,**kwargs): 278 | groupid = self.groupid 279 | auth = self.auth 280 | changeOwnserRequest = kwargs.get("changeOwnerRequest", None) 281 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v1/groups/{groupid}/change-owner', payload=changeOwnserRequest, cookies=auth) 282 | if response[0] == 200: 283 | return True 284 | else: 285 | return False, response[4] 286 | 287 | # POST : "https://groups.roblox.com/v1/groups/{groupid}/claim-ownership" 288 | # Docs : https://groups.roblox.com/docs#!/Membership/post_v1_groups_groupId_claim_ownership 289 | async def claimOwnership(self,**kwargs): 290 | groupid = self.groupid 291 | auth = self.auth 292 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v1/groups/{groupid}/claim-ownership', payload={}, cookies=auth) 293 | if response[0] == 200: 294 | return True 295 | else: 296 | return False, response[4] 297 | 298 | # DELETE : "https://groups.roblox.com/v1/groups/{groupid}/users/{userid}" 299 | # Docs : https://groups.roblox.com/docs#!/Membership/delete_v1_groups_groupId_users_userId 300 | async def exile(self,**kwargs): 301 | groupid = self.groupid 302 | auth = self.auth 303 | userid = kwargs.get("userid", None) 304 | response = await Req.request(t="DEL", url=f'https://groups.roblox.com/v1/groups/{groupid}/users/{userid}', payload={}, cookies=auth) 305 | if response[0] == 200: 306 | return True 307 | else: 308 | return False, response[4] 309 | 310 | # PATCH : "https://groups.roblox.com/v1/groups/{groupid}/users/{userid}" 311 | # Docs : https://groups.roblox.com/docs#!/Membership/patch_v1_groups_groupId_users_userId 312 | async def promote(self,**kwargs): 313 | groupid = self.groupid 314 | auth = self.auth 315 | userid = kwargs.get("userid", None) 316 | request = kwargs.get("request", None) 317 | response = await Req.request(t="PATCH", url=f'https://groups.roblox.com/v1/groups/{groupid}/users/{userid}', payload=request, cookies=auth) 318 | if response[0] == 200: 319 | return True 320 | else: 321 | return False, response[4] 322 | 323 | 324 | class Revenue: 325 | 326 | def __init__(self,Groups_v1): 327 | self.Groups_v1 = Groups_v1 328 | self.groupid = Groups_v1.groupid 329 | self.auth = Groups_v1.auth 330 | 331 | # GET : "https://groups.roblox.com/v1/groups/{groupid}/payouts" 332 | # Docs : https://groups.roblox.com/docs#!/Revenue/get_v1_groups_groupId_payouts 333 | async def get(self): 334 | groupid = self.groupid 335 | auth = self.auth 336 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/payouts', cookies=auth) 337 | return response[4] 338 | 339 | # POST : "https://groups.roblox.com/v1/groups/{groupid}/payouts" 340 | # Docs : https://groups.roblox.com/docs#!/Revenue/post_v1_groups_groupId_payouts 341 | async def pay(self,**kwargs): 342 | groupid = self.groupid 343 | auth = self.auth 344 | request = kwargs.get("request", None) 345 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v1/groups/{groupid}/payouts', payload=request, cookies=auth) 346 | if response[0] == 200: 347 | return True 348 | else: 349 | return False, response[4] 350 | 351 | # POST : "https://groups.roblox.com/v1/groups/{groupId}/payouts/recurring" 352 | # Docs : https://groups.roblox.com/docs#!/Revenue/post_v1_groups_groupId_payouts_recurring 353 | async def update(self,**kwargs): 354 | groupid = self.groupid 355 | auth = self.auth 356 | request = kwargs.get("request", None) 357 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v1/groups/{groupid}/payouts/recurring', payload=request, cookies=auth) 358 | if response[0] == 200: 359 | return True 360 | else: 361 | return False, response[4] 362 | 363 | 364 | class Relationships: 365 | 366 | def __init__(self,Groups_v1): 367 | self.Groups_v1 = Groups_v1 368 | self.groupid = Groups_v1.groupid 369 | self.auth = Groups_v1.auth 370 | 371 | # GET : "https://groups.roblox.com/v1/groups/{groupId}/relationships/{groupRelationshipType}" 372 | # Docs : https://groups.roblox.com/docs#!/Relationships/get_v1_groups_groupId_relationships_groupRelationshipType 373 | async def get(self,**kwargs): 374 | groupid = self.groupid 375 | auth = self.auth 376 | groupRelationshipType = kwargs.get("groupRelationshipType", None) 377 | startRowIndex = kwargs.get("startRowIndex", 1) 378 | maxRows = kwargs.get("maxRows", 1) 379 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/relationships/{groupRelationshipType}?model.startRowIndex={startRowIndex}&model.maxRows={maxRows}', cookies=auth) 380 | return response[4] 381 | 382 | # DELETE : "https://groups.roblox.com/v1/groups/{groupId}/relationships/{groupRelationshipType}/requests" 383 | # Docs : https://groups.roblox.com/docs#!/Relationships/delete_v1_groups_groupId_relationships_groupRelationshipType_requests 384 | async def batchDecline(self,**kwargs): 385 | groupid = self.groupid 386 | auth = self.auth 387 | groupRelationshipType = kwargs.get("groupRelationshipType", None) 388 | request = kwargs.get("request", None) 389 | response = await Req.request(t="DELETE", url=f'https://groups.roblox.com/v1/groups/{groupid}/relationships/{groupRelationshipType}/requests', payload=request, cookies=auth) 390 | if response[0] == 200: 391 | return True 392 | else: 393 | return False, response[4] 394 | 395 | # GET : "https://groups.roblox.com/v1/groups/{groupId}/relationships/{groupRelationshipType}/requests" 396 | # Docs : https://groups.roblox.com/docs#!/Relationships/get_v1_groups_groupId_relationships_groupRelationshipType_requests 397 | async def batchGet(self,**kwargs): 398 | groupid = self.groupid 399 | auth = self.auth 400 | groupRelationshipType = kwargs.get("groupRelationshipType", None) 401 | startRowIndex = kwargs.get("startRowIndex", None) # Not used yet 402 | maxRows = kwargs.get("maxRows", None) # Not used yet 403 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/relationships/{groupRelationshipType}/requests', cookies=auth) 404 | response[4] 405 | 406 | # POST : "https://groups.roblox.com/v1/groups/{groupId}/relationships/{groupRelationshipType}/requests" 407 | # Docs : https://groups.roblox.com/docs#!/Relationships/post_v1_groups_groupId_relationships_groupRelationshipType_requests 408 | async def batchAccept(self,**kwargs): 409 | groupid = self.groupid 410 | auth = self.auth 411 | groupRelationshipType = kwargs.get("groupRelationshipType", None) 412 | request = kwargs.get("request", None) 413 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v1/groups/{groupid}/relationships/{groupRelationshipType}/requests', payload=request, cookies=auth) 414 | if response[0] == 200: 415 | return True 416 | else: 417 | return False, response[4] 418 | 419 | # DELETE : "https://groups.roblox.com/v1/groups/{groupid}/relationships/{groupRelationshipType}/{relatedGroupId}" 420 | # Docs : https://groups.roblox.com/docs#!/Relationships/delete_v1_groups_groupId_relationships_groupRelationshipType_relatedGroupId 421 | async def delete(self,**kwargs): 422 | groupid = self.groupid 423 | auth = self.auth 424 | groupRelationshipType = kwargs.get("groupRelationshipType", None) 425 | relatedGroupId = kwargs.get("relatedGroupId", None) 426 | response = await Req.request(t="DEL", url=f'https://groups.roblox.com/v1/groups/{groupid}/relationships/{groupRelationshipType}/{relatedGroupId}', cookies=auth) 427 | if response[0] == 200: 428 | return True 429 | else: 430 | return False, response[4] 431 | 432 | # POST : "https://groups.roblox.com/v1/groups/{groupid}/relationships/{groupRelationshipType}/{relatedGroupId}" 433 | # Docs : https://groups.roblox.com/docs#!/Relationships/post_v1_groups_groupId_relationships_groupRelationshipType_relatedGroupId 434 | async def create(self,**kwargs): 435 | groupid = self.groupid 436 | auth = self.auth 437 | groupRelationshipType = kwargs.get("groupRelationshipType", None) 438 | relatedGroupId = kwargs.get("relatedGroupId", None) 439 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v1/groups/{groupid}/relationships/{groupRelationshipType}/{relatedGroupId}', cookies=auth) 440 | if response[0] == 200: 441 | return True 442 | else: 443 | return False, response[4] 444 | 445 | # DELETE : "https://groups.roblox.com/v1/groups/{groupid}/relationships/{groupRelationshipType}/requests/{relatedGroupId}" 446 | # Docs : https://groups.roblox.com/docs#!/Relationships/delete_v1_groups_groupId_relationships_groupRelationshipType_requests_relatedGroupId 447 | async def decline(self,**kwargs): 448 | groupid = self.groupid 449 | auth = self.auth 450 | groupRelationshipType = kwargs.get("groupRelationshipType", None) 451 | relatedGroupId = kwargs.get("relatedGroupId", None) 452 | response = await Req.request(t="DEL", url=f'https://groups.roblox.com/v1/groups/{groupid}/relationships/{groupRelationshipType}/requests/{relatedGroupId}', cookies=auth) 453 | if response[0] == 200: 454 | return True 455 | else: 456 | return False, response[4] 457 | 458 | # POST : "https://groups.roblox.com/v1/groups/{groupid}/relationships/{groupRelationshipType}/requests/{relatedGroupId}" 459 | # Docs : https://groups.roblox.com/docs#!/Relationships/post_v1_groups_groupId_relationships_groupRelationshipType_requests_relatedGroupId 460 | async def accept(self,**kwargs): 461 | groupid = self.groupid 462 | auth = self.auth 463 | groupRelationshipType = kwargs.get("groupRelationshipType", None) 464 | relatedGroupId = kwargs.get("relatedGroupId", None) 465 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v1/groups/{groupid}/relationships/{groupRelationshipType}/requests/{relatedGroupId}', cookies=auth) 466 | if response[0] == 200: 467 | return True 468 | else: 469 | return False, response[4] 470 | 471 | 472 | class Permissions: 473 | 474 | def __init__(self,Groups_v1): 475 | self.Groups_v1 = Groups_v1 476 | self.groupid = Groups_v1.groupid 477 | self.auth = Groups_v1.auth 478 | 479 | # GET : "https://groups.roblox.com/v1/groups/{groupid}/roles/{roleSetId}/permissions" 480 | # Docs : https://groups.roblox.com/docs#!/Permissions/get_v1_groups_groupId_roles_roleSetId_permissions 481 | async def rolesetIndex(self,**kwargs): 482 | groupid = self.groupid 483 | auth = self.auth 484 | roleSetId = kwargs.get("roleSetId", None) 485 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/roles/{roleSetId}/permissions', cookies=auth) 486 | return response[4] 487 | 488 | # PATCH : "https://groups.roblox.com/v1/groups/{groupid}/roles/{roleSetId}/permissions" 489 | # Docs : https://groups.roblox.com/docs#!/Permissions/patch_v1_groups_groupId_roles_roleSetId_permissions 490 | async def rolesetUpdate(self,**kwargs): 491 | groupid = self.groupid 492 | auth = self.auth 493 | roleSetId = kwargs.get("roleSetId", None) 494 | updatePermissionsRequest = kwargs.get("updatePermissionsRequest", None) 495 | response = await Req.request(t="PATCH", url=f'https://groups.roblox.com/v1/groups/{groupid}/roles/{roleSetId}/permissions', payload=updatePermissionsRequest, cookies=auth) 496 | if response[0] == 200: 497 | return True 498 | else: 499 | return False, response[4] 500 | 501 | # GET : "https://groups.roblox.com/v1/groups/{groupid}/roles/{roleSetId}/permissions" 502 | # Docs : https://groups.roblox.com/docs#!/Permissions/get_v1_groups_groupId_roles_guest_permissions 503 | async def guestIndex(self,**kwargs): 504 | groupid = self.groupid 505 | auth = self.auth 506 | roleSetId = kwargs.get("roleSetId", None) 507 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/roles/{roleSetId}/permissions', cookies=auth) 508 | return response[4] 509 | 510 | 511 | # GET : "https://groups.roblox.com/v1/groups/{groupid}/roles/permissions" 512 | # Docs : https://groups.roblox.com/docs#!/Permissions/get_v1_groups_groupId_roles_permissions 513 | async def get(self): 514 | groupid = self.groupid 515 | auth = self.auth 516 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/roles/permissions', cookies=auth) 517 | return response[4] 518 | 519 | 520 | class socialLinks: 521 | 522 | def __init__(self,Groups_v1): 523 | self.Groups_v1 = Groups_v1 524 | self.groupid = Groups_v1.groupid 525 | self.auth = Groups_v1.auth 526 | 527 | # GET : "https://groups.roblox.com/v1/groups/{groupid}/social-links" 528 | # Docs : https://groups.roblox.com/docs#!/SocialLinks/get_v1_groups_groupId_social_links 529 | async def get(self): 530 | groupid = self.groupid 531 | auth = self.auth 532 | response = await Req.request(t="GET", url=f'', cookies=auth) 533 | return response[4] 534 | 535 | # POST : "https://groups.roblox.com/v1/groups/{groupid}/social-links" 536 | # Docs : https://groups.roblox.com/docs#!/SocialLinks/post_v1_groups_groupId_social_links 537 | async def post(self,**kwargs): 538 | groupid = self.groupid 539 | auth = self.auth 540 | request = kwargs.get("request", None) 541 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v1/groups/{groupid}/social-links', payload=request, cookies=auth) 542 | return response[4] 543 | 544 | # DELETE : "https://groups.roblox.com/v1/groups/{groupid}/social-links/{socialLinkId}" 545 | # Docs : https://groups.roblox.com/docs#!/SocialLinks/delete_v1_groups_groupId_social_links_socialLinkId 546 | async def delete(self,**kwargs): 547 | groupid = self.groupid 548 | auth = self.auth 549 | socialLinkId = kwargs.get("", None) 550 | response = await Req.request(t="DEL", url=f'https://groups.roblox.com/v1/groups/{groupid}/social-links/{socialLinkId}', cookies=auth) 551 | if response[0] == 200: 552 | return True 553 | else: 554 | return False, response[4] 555 | 556 | # PATCH : "https://groups.roblox.com/v1/groups/{groupid}/social-links/{socialLinkId}" 557 | # Docs : https://groups.roblox.com/docs#!/SocialLinks/patch_v1_groups_groupId_social_links_socialLinkId 558 | async def update(self,**kwargs): 559 | groupid = self.groupid 560 | auth = self.auth 561 | socialLinkId = kwargs.get("socialLinkId", None) 562 | request = kwargs.get("request", None) 563 | response = await Req.request(t="PATCH", url=f'https://groups.roblox.com/v1/groups/{groupid}/social-links/{socialLinkId}', payload=request, cookies=auth) 564 | if response[0] == 200: 565 | return True 566 | else: 567 | return False, response[4] 568 | 569 | 570 | class Wall: 571 | 572 | def __init__(self,Groups_v1): 573 | self.Groups_v1 = Groups_v1 574 | self.groupid = Groups_v1.groupid 575 | self.auth = Groups_v1.auth 576 | 577 | # GET: "https://groups.roblox.com/v1/groups/{groupid}/wall/posts" 578 | # Docs : https://groups.roblox.com/docs#!/Wall/get_v1_groups_groupId_wall_posts 579 | async def get(self,**kwargs): 580 | groupid = self.groupid 581 | auth = self.auth 582 | sortOrder = kwargs.get("sortOrder", None) # Not used yet 583 | limit = kwargs.get("limit", None) # Not used yet 584 | cursor = kwargs.get("cursor", None) # Not used yet 585 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/{groupid}/wall/posts', cookies=auth) 586 | return response[4] 587 | 588 | # POST : "https://groups.roblox.com/v1/groups/{groupid}/wall/posts" 589 | # Docs : https://groups.roblox.com/docs#!/Wall/post_v1_groups_groupId_wall_posts 590 | async def post(self,**kwargs): 591 | groupid = self.groupid 592 | auth = self.auth 593 | request = kwargs.get("request", None) 594 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v1/groups/{groupid}/wall/posts', payload=request, cookies=auth) 595 | return response[0] 596 | 597 | # DELETE : "https://groups.roblox.com/v1/groups/{groupid}/wall/posts/{postId}" 598 | # Docs : https://groups.roblox.com/docs#!/Wall/delete_v1_groups_groupId_wall_posts_postId 599 | async def delete(self,**kwargs): 600 | groupid = self.groupid 601 | auth = self.auth 602 | postId = kwargs.get("postId", None) 603 | response = await Req.request(t="DEL", url=f'https://groups.roblox.com/v1/groups/{groupid}/wall/posts/{postId}', cookies=auth) 604 | if response[0] == 200: 605 | return True 606 | else: 607 | return False, response[4] 608 | 609 | # DELETE : "https://groups.roblox.com/v1/groups/{groupid}/wall/users/{userId}/posts" 610 | # Docs : https://groups.roblox.com/docs#!/Wall/delete_v1_groups_groupId_wall_users_userId_posts 611 | async def deleteFromUserid(self,**kwargs): 612 | groupid = self.groupid 613 | auth = self.auth 614 | userId = kwargs.get("userId", None) 615 | response = await Req.request(t="DEL", url=f'https://groups.roblox.com/v1/groups/{groupid}/wall/users/{userId}/posts', cookies=auth) 616 | if response[0] == 200: 617 | return True 618 | else: 619 | return False, response[4] 620 | 621 | 622 | class groupSearch: 623 | 624 | def __init__(self,Groups_v1): 625 | self.Groups_v1 = Groups_v1 626 | self.groupid = Groups_v1.grouid 627 | self.auth = Groups_v1.auth 628 | 629 | # GET : "https://groups.roblox.com/v1/groups/search" 630 | # Docs : https://groups.roblox.com/docs#!/GroupSearch/get_v1_groups_search 631 | async def byKeyword(self,**kwargs): 632 | auth = self.auth 633 | keyword = kwargs.get("keyword", None) 634 | limit = kwargs.get("limit", None) # Not used yet 635 | cursor = kwargs.get("cursor", None) # Not used yet 636 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/search?keyword={keyword}&limit=10', cookies=auth) 637 | return response[4] 638 | 639 | # GET : "https://groups.roblox.com/v1/groups/search/lookup" 640 | # Docs : https://groups.roblox.com/docs#!/GroupSearch/get_v1_groups_search_lookup 641 | async def byExactMatch(self,**kwargs): 642 | auth = self.auth 643 | groupName = kwargs.get("groupName", None) 644 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/search/lookup?groupName={groupName}', cookies=auth) 645 | return response[4] 646 | 647 | # GET : "https://groups.roblox.com/v1/groups/search/metadata" 648 | # Docs : https://groups.roblox.com/docs#!/GroupSearch/get_v1_groups_search_metadata 649 | async def metadata(self): 650 | auth = self.auth 651 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/groups/search/metadata', cookies=auth) 652 | return response[4] 653 | 654 | 655 | class Roles: 656 | 657 | def __init__(self,Groups_v1): 658 | self.Groups_v1 = Groups_v1 659 | self.groupid = Groups_v1.groupid 660 | self.auth = Groups_v1.auth 661 | 662 | # GET : "https://groups.roblox.com/v1/roles" 663 | # Docs : https://groups.roblox.com/docs#!/Roles/get_v1_roles 664 | async def get(self,**kwargs): 665 | auth = self.auth 666 | ids = kwargs.get("ids", None) 667 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/roles?ids={ids}', cookies=auth) 668 | return response[4] 669 | 670 | class primaryGroup: 671 | 672 | def __init__(self,Groups_v1): 673 | self.Groups_v1 = Groups_v1 674 | self.groupid = Groups_v1.groupid 675 | self.auth = Groups_v1.auth 676 | 677 | # GET : "https://groups.roblox.com/v1/users/{userId}/groups/primary/role" 678 | # Docs : https://groups.roblox.com/docs#!/PrimaryGroup/get_v1_users_userId_groups_primary_role 679 | async def get(self,**kwargs): 680 | groupid = self.groupid 681 | auth = self.auth 682 | userId = kwargs.get("userId", None) 683 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v1/users/{userId}/groups/primary/role', cookies=auth) 684 | return response[0] 685 | 686 | # DELETE : "https://groups.roblox.com/v1/user/groups/primary" 687 | # Docs : https://groups.roblox.com/docs#!/PrimaryGroup/delete_v1_user_groups_primary 688 | async def remove(self): 689 | groupid = self.groupid 690 | auth = self.auth 691 | response = await Req.request(t="DEL", url=f'https://groups.roblox.com/v1/user/groups/primary', cookies=auth) 692 | if response[0] == 200: 693 | return True 694 | else: 695 | return False, response[4] 696 | 697 | # POST : "https://groups.roblox.com/v1/user/groups/primary" 698 | # Docs : https://groups.roblox.com/docs#!/PrimaryGroup/post_v1_user_groups_primary 699 | async def setTo(self,**kwargs): 700 | groupid = self.groupid 701 | auth = self.auth 702 | request = kwargs.get("request", None) 703 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v1/user/groups/primary', payload=request, cookies=auth) 704 | if response[0] == 200: 705 | return True 706 | else: 707 | return False, response[4] 708 | 709 | 710 | class roleSets: 711 | 712 | def __init__(self,Groups_v1): 713 | self.Groups_v1 = Groups_v1 714 | self.groupid = Groups_v1.groupid 715 | self.auth = Groups_v1.auth 716 | 717 | # POST : "https://groups.roblox.com/v1/groups/{groupid}/rolesets/create" 718 | # Docs : https://groups.roblox.com/docs#!/RoleSets/post_v1_groups_groupId_rolesets_create 719 | async def create(self,**kwargs): 720 | groupid = self.groupid 721 | auth = self.auth 722 | request = kwargs.get("request", None) 723 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v1/groups/{groupid}/rolesets/create', payload=request, cookies=auth) 724 | return response[4] 725 | 726 | # DELETE : "https://groups.roblox.com/v1/groups/{groupid}/rolesets/{rolesetId}" 727 | # Docs : https://groups.roblox.com/docs#!/RoleSets/delete_v1_groups_groupId_rolesets_rolesetId 728 | async def delete(self,**kwargs): 729 | groupid = self.groupid 730 | auth = self.auth 731 | rolesetId = kwargs.get("rolesetId", None) 732 | response = await Req.request(t="DEL", url=f'https://groups.roblox.com/v1/groups/{groupid}/rolesets/{rolesetId}', cookies=auth) 733 | if response[0] == 200: 734 | return True 735 | else: 736 | return False, response[4] 737 | 738 | # PATCH : "https://groups.roblox.com/v1/groups/{groupid}/rolesets/{rolesetId}" 739 | # Docs : https://groups.roblox.com/docs#!/RoleSets/patch_v1_groups_groupId_rolesets_rolesetId 740 | async def update(self,**kwargs): 741 | groupid = self.groupid 742 | auth = self.auth 743 | rolesetId = kwargs.get("rolesetId", None) 744 | request = kwargs.get("request", None) 745 | response = await Req.request(t="PATCH", url=f'https://groups.roblox.com/v1/groups/{groupid}/rolesets/{rolesetId}', payload=request, cookies=auth) 746 | return response[4] 747 | 748 | 749 | class Groups_v2: 750 | 751 | def __init__(self,**kwargs): 752 | groupid = kwargs.get("groupid", None) 753 | auth = kwargs.get("auth", None) 754 | self.groupid = groupid 755 | self.auth = auth.auth_cookies 756 | self.Groups = self.Groups(self) 757 | self.Wall = self.Wall(self) 758 | 759 | class Groups: 760 | 761 | def __init__(self,Groups_v1): 762 | self.Groups_v1 = Groups_v1 763 | self.groupid = Groups_v1.groupid 764 | self.auth = Groups_v1.auth 765 | 766 | # GET : "https://groups.roblox.com/v2/groups" 767 | # Docs : https://groups.roblox.com/docs#!/Groups/get_v2_groups 768 | async def multiGet(self,**kwargs): 769 | auth = self.auth 770 | groupIds = kwargs.get("groupIds", None) 771 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v2/groups?groupIds={groupIds}', cookies=auth) 772 | return response[4] 773 | 774 | # GET : "https://groups.roblox.com/v2/users/{userId}/groups/roles" 775 | # Docs : https://groups.roblox.com/docs#!/Groups/get_v2_users_userId_groups_roles 776 | async def roleIndex(self,**kwargs): 777 | groupid = self.groupid 778 | auth = self.auth 779 | userId = kwargs.get("userId", None) 780 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v2/users/{userId}/groups/roles', cookies=auth) 781 | return response[4] 782 | 783 | 784 | class Wall: 785 | 786 | def __init__(self,Groups_v1): 787 | self.Groups_v1 = Groups_v1 788 | self.groupid = Groups_v1.groupid 789 | self.auth = Groups_v1.auth 790 | 791 | # GET : "https://groups.roblox.com/v2/groups/{groupid}/wall/posts" 792 | # Docs : https://groups.roblox.com/docs#!/Wall/get_v2_groups_groupId_wall_posts 793 | async def get(self,**kwargs): 794 | groupid = self.groupid 795 | auth = self.auth 796 | sortOrder = kwargs.get("sortOrder", None) # Not used yet 797 | limit = kwargs.get("limit", None) # Not used yet 798 | cursor = kwargs.get("cursor", None) # Not used yet 799 | response = await Req.request(t="GET", url=f'https://groups.roblox.com/v2/groups/{groupid}/wall/posts?sortOrder=Asc&limit=10', cookies=auth) 800 | return response[4] 801 | 802 | # POST : "https://groups.roblox.com/v2/groups/{groupid}/wall/posts" 803 | # Docs : https://groups.roblox.com/docs#!/Wall/post_v2_groups_groupId_wall_posts 804 | async def post(self,**kwargs): 805 | groupid = self.groupid 806 | auth = self.auth 807 | request = kwargs.get("request", None) 808 | response = await Req.request(t="POST", url=f'https://groups.roblox.com/v2/groups/{groupid}/wall/posts', payload=request, cookies=auth) 809 | return response[4] 810 | -------------------------------------------------------------------------------- /src/webapi/privateMessages.py: -------------------------------------------------------------------------------- 1 | # 2 | # privateMessages.py 3 | # pyblox 4 | # 5 | # By sbhadr (Sanjay Bhadra) 6 | # Copyright © 2024- sbhadr (Sanjay Bhadra). All rights reserved. 7 | # 8 | 9 | from .util import Req 10 | 11 | Req = Req() 12 | 13 | class privateMessages_v1: 14 | 15 | def __init__(self,**kwargs): 16 | auth = kwargs.get("auth", None) 17 | self.auth = auth.auth_cookies 18 | self.Announcements = self.Users(self) 19 | self.Messages = self.userSearch(self) 20 | 21 | class Announcements: 22 | def __init__(self, privateMessages_v1): 23 | self.privateMessages_v1 = privateMessages_v1 24 | self.auth = privateMessages_v1.auth 25 | 26 | # GET : "https://privatemessage.roblox.com/v1/announcements" 27 | # Docs : https://privatemessages.roblox.com/docs#!/Announcements/get_v1_announcements 28 | async def get(self): 29 | auth = self.auth 30 | response = await Req.request(t="GET", url=f'https://privatemessage.roblox.com/v1/announcements', cookies=auth) 31 | return response[4] 32 | 33 | # GET : "https://privatemessage.roblox.com/v1/metadata" 34 | # Docs : https://privatemessages.roblox.com/docs#!/Announcements/get_v1_announcements_metadata 35 | async def metadata(self): 36 | auth = self.auth 37 | response = await Req.request(t="GET", url=f'https://privatemessage.roblox.com/v1/metadata', cookies=auth) 38 | return response[4] 39 | 40 | class Messages: 41 | 42 | def __init__(self, privateMessages_v1): 43 | self.privateMessages_v1 = privateMessages_v1 44 | self.auth = privateMessages_v1.auth 45 | 46 | # GET : "https://privatemessage.roblox.com/v1/messages" 47 | # Docs : https://privatemessages.roblox.com/docs#!/Messages/get_v1_messages 48 | async def get(self): 49 | auth = self.auth 50 | response = await Req.request(t="GET", url=f'https://privatemessage.roblox.com/v1/messages', cookies=auth) 51 | return response[4] 52 | 53 | # GET : "https://privatemessage.roblox.com/v1/messages/{messageId}" 54 | # Docs : https://privatemessages.roblox.com/docs#!/Messages/get_v1_messages_messageId 55 | async def getByMessageId(self, **kwargs): 56 | auth = self.auth 57 | messageId = kwargs.get("messageId", None) 58 | response = await Req.request(t="GET", url=f'https://privatemessage.roblox.com/v1/messages/{messageId}', cookies=auth) 59 | return response[4] 60 | 61 | # GET : "https://privatemessage.roblox.com/v1/messages/{userId}/can-message" 62 | # Docs : https://privatemessages.roblox.com/docs#!/Messages/get_v1_messages_userId_can_message 63 | async def getByUserId(self, **kwargs): 64 | auth = self.auth 65 | userId = kwargs.get("userId", None) 66 | response = await Req.request(t="GET", url=f'https://privatemessage.roblox.com/v1/messages/{userId}/can-message', cookies=auth) 67 | return response[4] 68 | 69 | # GET : "https://privatemessage.roblox.com/v1/messages/unread/count" 70 | # Docs : https://privatemessages.roblox.com/docs#!/Messages/get_v1_messages_unread_count 71 | async def getUnreadCount(self): 72 | auth = self.auth 73 | response = await Req.request(t="GET", url=f'https://privatemessage.roblox.com/v1/messages/unread/count', cookies=auth) 74 | return response[4] 75 | 76 | # POST : "https://privatemessage.roblox.com/v1/messages/archive" 77 | # Docs : https://privatemessages.roblox.com/docs#!/Messages/post_v1_messages_archive 78 | async def archive(self, **kwargs): 79 | auth = self.auth 80 | request = kwargs.get("batchMessagesRequest", None) 81 | response = await Req.request(t="POST", url=f'https://privatemessage.roblox.com/v1/messages/archive', payload=request, cookies=auth) 82 | if response[0] == 200: 83 | return True 84 | return False, response[4] 85 | 86 | # POST : "https://privatemessage.roblox.com/v1/messages/mark-read" 87 | # Docs : https://privatemessages.roblox.com/docs#!/Messages/post_v1_messages_mark_read 88 | async def markRead(self, **kwargs): 89 | auth = self.auth 90 | request = kwargs.get("batchMessagesRequest", None) 91 | response = await Req.request(t="POST", url=f'https://privatemessage.roblox.com/v1/messages/mark-read', payload=request, cookies=auth) 92 | if response[0] == 200: 93 | return True 94 | return False, response[4] 95 | 96 | # POST : "https://privatemessage.roblox.com/v1/messages/mark-unread" 97 | # Docs : https://privatemessages.roblox.com/docs#!/Messages/post_v1_messages_mark_unread 98 | async def markUnread(self, **kwargs): 99 | auth = self.auth 100 | request = kwargs.get("batchMessagesRequest", None) 101 | response = await Req.request(t="POST", url=f'https://privatemessage.roblox.com/v1/messages/mark-unread', payload=request, cookies=auth) 102 | if response[0] == 200: 103 | return True 104 | return False, response[4] 105 | 106 | # POST : "https://privatemessage.roblox.com/v1/messages/send" 107 | # Docs : https://privatemessages.roblox.com/docs#!/Messages/post_v1_messages_send 108 | async def send(self, **kwargs): 109 | auth = self.auth 110 | request = kwargs.get("sendMessagesRequest", None) 111 | response = await Req.request(t="POST", url=f'https://privatemessage.roblox.com/v1/messages/send', payload=request, cookies=auth) 112 | if response[0] == 200: 113 | return True 114 | return False, response[4] 115 | 116 | # POST : "https://privatemessage.roblox.com/v1/messages/unarchive" 117 | # Docs : https://privatemessages.roblox.com/docs#!/Messages/post_v1_messages_unarchive 118 | async def send(self, **kwargs): 119 | auth = self.auth 120 | request = kwargs.get("batchMessagesRequest", None) 121 | response = await Req.request(t="POST", url=f'https://privatemessage.roblox.com/v1/messages/unarchive', payload=request, cookies=auth) 122 | if response[0] == 200: 123 | return True 124 | return False, response[4] -------------------------------------------------------------------------------- /src/webapi/users.py: -------------------------------------------------------------------------------- 1 | # 2 | # users.py 3 | # pyblox 4 | # 5 | # By sbhadr (Sanjay Bhadra) 6 | # Copyright © 2024- sbhadr (Sanjay Bhadra). All rights reserved. 7 | # 8 | 9 | from .util import Req 10 | 11 | Req = Req() 12 | 13 | class Users_v1: 14 | 15 | def __init__(self,**kwargs): 16 | auth = kwargs.get("auth", None) 17 | self.auth = auth.auth_cookies 18 | self.Users = self.Users(self) 19 | self.userSearch = self.userSearch(self) 20 | 21 | class Users: 22 | 23 | def __init__(self,Users_v1): 24 | self.Users_v1 = Users_v1 25 | self.auth = Users_v1.auth 26 | 27 | # GET : "https://users.roblox.com/v1/users/{userId}" 28 | # Docs : https://users.roblox.com/docs#!/Users/get_v1_users_userId 29 | async def get(self,**kwargs): 30 | auth = self.auth 31 | userId = kwargs.get("userId", None) 32 | response = await Req.request(t="GET", url=f'https://users.roblox.com/v1/users/{userId}', cookies=auth) 33 | return response[4] 34 | 35 | # GET : "https://users.roblox.com/v1/users/authenticated" 36 | # Docs : https://users.roblox.com/docs#!/Users/get_v1_users_authenticated 37 | async def minAuth(self): 38 | auth = self.auth 39 | response = await Req.request(t="GET", url=f'https://users.roblox.com/v1/users/authenticated', cookies=auth) 40 | return response[4] 41 | 42 | # POST : "https://users.roblox.com/v1/usernames/users" 43 | # Docs : https://users.roblox.com/docs#!/Users/post_v1_usernames_users 44 | async def fromUsername(self,**kwargs): 45 | auth = self.auth 46 | request = kwargs.get("request", None) 47 | response = await Req.request(t="POST", url=f'https://users.roblox.com/v1/usernames/users', payload=request, cookies=auth) 48 | if response[0] == 200: 49 | return True 50 | else: 51 | return False, response[4] 52 | 53 | # POST : "https://users.roblox.com/v1/users" 54 | # Docs : https://users.roblox.com/docs#!/Users/post_v1_users 55 | async def fromId(self,**kwargs): 56 | auth = self.auth 57 | request = kwargs.get("request", None) 58 | response = await Req.request(t="POST", url=f'https://users.roblox.com/v1/users', payload=request, cookies=auth) 59 | if response[0] == 200: 60 | return True 61 | else: 62 | return False, response[4] 63 | 64 | class userSearch: 65 | 66 | def __init__(self,Users_v1): 67 | self.Users_v1 = Users_v1 68 | self.auth = Users_v1.auth 69 | 70 | # GET : "https://users.roblox.com/v1/users/search" 71 | # Docs : https://users.roblox.com/docs#!/UserSearch/get_v1_users_search 72 | async def fromKeyword(self,**kwargs): 73 | auth = self.auth 74 | keyword = kwargs.get("keyword", None) 75 | limit = kwargs.get("limit", None) # Not used yet 76 | keyword = kwargs.get("cursor", None) # Not used yet 77 | response = await Req.request(t="GET", url=f'https://users.roblox.com/v1/users/search?keyword={keyword}') 78 | return response[4] 79 | -------------------------------------------------------------------------------- /src/webapi/util/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # __init__.py 3 | # pyblox -> util 4 | # 5 | # By sbhadr (Sanjay Bhadra) 6 | # Copyright © 2024- sbhadr (Sanjay Bhadra). All rights reserved. 7 | # 8 | 9 | # Some nifty methods that I like to keep handy because 10 | # I write them over and over for every project. 11 | # Bet you relate.. 12 | # 13 | # Message from Sanjay 2024: Who the hell uses 14 | # the word nifty..? 15 | 16 | # Parent Class Modules 17 | from .req import Req 18 | from .io import io 19 | from .cached import Cached 20 | -------------------------------------------------------------------------------- /src/webapi/util/cached.py: -------------------------------------------------------------------------------- 1 | # 2 | # util -> cached.py 3 | # pyblox 4 | # 5 | # By sbhadr (Sanjay Bhadra) 6 | # Copyright © 2024- sbhadr (Sanjay Bhadra). All rights reserved. 7 | # 8 | 9 | class Cached: 10 | cache = {} 11 | file_cache = {} 12 | auth = {} -------------------------------------------------------------------------------- /src/webapi/util/io.py: -------------------------------------------------------------------------------- 1 | # 2 | # util -> jsoni.py 3 | # pyblox 4 | # 5 | # By sbhadr (Sanjay Bhadra) 6 | # Copyright © 2024- sbhadr (Sanjay Bhadra). All rights reserved. 7 | # 8 | 9 | import json 10 | import os 11 | import inspect 12 | 13 | class io: 14 | 15 | def read(**kwargs): 16 | file = kwargs.get("file",None) 17 | with open(str(file),"r",encoding="utf-8") as jfile: 18 | data = json.load(jfile) 19 | return data 20 | 21 | def write(**kwargs): 22 | file = kwargs.get("file",None) 23 | key = kwargs.get("key",None) 24 | value = kwargs.get("value",None) 25 | with open(str(file),"r",encoding="utf-8") as jfile: 26 | data = json.load(jfile) 27 | jfile.close() 28 | data[str(key)].append(value) 29 | with open(str(file),"w",encoding="utf-8") as jfile: 30 | json.dumps(data,jfile) 31 | jfile.close() 32 | 33 | def getPath(): 34 | file_string = os.path.abspath(inspect.stack()[-1][1]) 35 | print(file_string) 36 | print(file_string[:27]) 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/webapi/util/req.py: -------------------------------------------------------------------------------- 1 | # 2 | # util -> req.py 3 | # pyblox 4 | # 5 | # By sbhadr (Sanjay Bhadra) 6 | # Copyright © 2024- sbhadr (Sanjay Bhadra). All rights reserved. 7 | # 8 | 9 | import httpx 10 | 11 | class HttpError(Exception): 12 | """ 13 | Base class that represents an HTTP Error in the form of an exception. 14 | """ 15 | def __init__(self, kind="Generic", message="Generic Error", url="Somewhere"): 16 | """ 17 | Creates an exception with specified message. 18 | If not message is provided, it defaults to "Generic Error". 19 | 20 | @param kind: str. Represents the the kind of exception. 21 | @param message: str. Represents the error message of the exception. 22 | @param url: str. Represents the url the error occured at. 23 | """ 24 | self.kind = kind 25 | self.message = message 26 | self.url = url 27 | super().__init__(self.message) 28 | 29 | 30 | class Req: 31 | """ 32 | Base class that holds HTTP request and response mechanisms. 33 | """ 34 | 35 | async def request(self, t: str, url: str, payload=None, header={}, cookies={}): 36 | """ 37 | Creates, executes and returns a request in the form of a response. 38 | Throws an exception if conditions are not met. 39 | 40 | @param t: Str. Type of request. ie. GET, POST, PATCH, DELETE or DEL. 41 | Can also be lowercase, snakecase, etc. 42 | @param url: Str. URL to send the request. 43 | @param payload: Dict or None. Represents the payload or data to send 44 | the request with. 45 | @param header: Dict. Represents the headers to send the request with. 46 | @param cookies: Dict. Represents the cookies to send the request with. 47 | 48 | @return: Tuple. 49 | 50 | @example: 51 | 52 | # GET Request 53 | response = Req.request(t="GET",url="http://httpbin.org/get") 54 | 55 | # You can get the status of the request by doing: 56 | response[0] 57 | 58 | # And so on... its a tuple so this also works as a shorthand: 59 | response = Req.request(t="GET",url="http://httpbin.org/get")[0] 60 | 61 | @example: 62 | 63 | # POST Request 64 | data = {"Username":"JohnDoe","Password":"JaneDoe"} 65 | 66 | # Data you want to send as a payload 67 | response = Req.request(t="POST",url="http//httpbin.org/post",payload=data) 68 | 69 | # Again, all data is returned wholesale as a tuple so this works: 70 | response[0] # Gets you the status of the request 71 | 72 | # Once again, this works as a shorthand: 73 | response = Req.request(t="POST",url"http://httpbin.org/post",payload=data)[0] 74 | """ 75 | async with httpx.AsyncClient(cookies=cookies) as client: 76 | 77 | # TODO: Backwards Compatibility (will be renamed to this later) 78 | kind = t.upper() 79 | headers = header 80 | 81 | # Obtain our initial token (fresh) 82 | response = await client.post(url="https://www.roblox.com/authentication/signoutfromallsessionsandreauthenticate", data=None, headers=headers) 83 | csrf_token = response.headers.get("X-CSRF-TOKEN") 84 | if not csrf_token: 85 | raise HttpError("POST Request", "Initial X-CSRF-TOKEN was not found in headers, aborted", url) 86 | 87 | # Perform actual request 88 | headers["X-CSRF-TOKEN"] = csrf_token 89 | if kind == "GET": 90 | response = await client.get(url, headers=headers) 91 | elif kind == "POST": 92 | if not cookies: 93 | raise HttpError("POST Request", "Endpoint requires account cookie / authentication", url) 94 | elif not payload: 95 | raise HttpError("POST Request", "Endpoint requires payload / request body", url) 96 | response = await client.post(url=url, data=payload, headers=headers) 97 | elif kind == "PATCH": 98 | if not cookies: 99 | raise HttpError("PATCH Request", "Endpoint requires account cookie / authentication", url) 100 | elif not payload: 101 | raise HttpError("PATCH Request", "Endpoint requires payload / request body", url) 102 | response = await client.patch(url=url, data=payload, headers=headers) 103 | elif kind == ("DEL" or "DELETE"): 104 | if not cookies: 105 | raise HttpError("DELETE Request", "Endpoint requires account cookie / authentication", url) 106 | response = await client.delete(url=url, payload=payload, headers=headers) 107 | return self.parse_response(response) 108 | 109 | def parse_response(self, response): 110 | """ 111 | Parses respone into expected tuple format. 112 | 113 | @param response: Response. The response object from the request that has been performed. 114 | 115 | @return: tuple. If the status code is 200, the return is Tuple(status_code, content, headers, encoding, json). 116 | If the status code is not 200, the return is Tuple(status_code, content, headers, encoding, json["errors"][0]). 117 | Note that a status code of 200 means the request is successful. Otherwise, an error has occured. 118 | """ 119 | status_code = response.status_code 120 | content = response.content 121 | headers = response.headers 122 | encoding = response.encoding 123 | json = response.json() 124 | if status_code == 200: 125 | return status_code, content, headers, encoding, json 126 | return status_code, content, headers, encoding, json["errors"][0] -------------------------------------------------------------------------------- /tests/TESTFILE.py: -------------------------------------------------------------------------------- 1 | # 2 | # TESTFILE.py 3 | # pyblox 4 | # 5 | # By sbhadr (Sanjay Bhadra) 6 | # Copyright © 2024- sbhadr (Sanjay Bhadra). All rights reserved. 7 | # 8 | # This file does can be deleted w/o any issues to source. 9 | # 10 | 11 | import asyncio 12 | from src import Auth_v2, Groups_v1 13 | 14 | test_data = { 15 | "isApprovalRequired": False, 16 | "isBuildersClubRequired": False, 17 | "areEnemiesAllowed": False, 18 | "areGroupFundsVisible": True, 19 | "areGroupGamesVisible": True 20 | } 21 | 22 | # Instance your auth details 23 | base_bot_user = Auth_v2(cookies={'.ROBLOSECURITY': "YourCookie"}) 24 | # Instance your group as a variable 25 | base_group = Groups_v1(groupid=7,auth=base_bot_user) 26 | 27 | # Standard Event Loop 28 | async def event_loop(): 29 | group_info = await base_group.Membership.get() 30 | print(group_info) 31 | 32 | # Async stuff, woohoo 33 | loop = asyncio.get_event_loop() 34 | loop.run_until_complete(event_loop()) 35 | loop.close() 36 | 37 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RbxAPI/Pyblox/f44aa0ada2e5b28443736aaee6c20eda09517ad3/tests/__init__.py --------------------------------------------------------------------------------