import robloxapi
async def grouprank(userId, rankName):
# omitted rank-name to role id mapping
rankId = dic[rankName]
client = robloxapi.Client(cookie=NOT_STUPID_ENOUGH_TO_DISCLOSE)
grp = await client.get_group(32409863)
await robloxapi.client.Group.set_rank_by_id(grp, userId, rankId)
import asyncio
lp = asyncio.new_event_loop()
lp.run_until_complete(grouprank(2315210162, "Recruit"))
The code above throws the following error: ssl.SSLError: Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:795)
This code is mainly to rank a player to another rank in a roblox group using a bot
For me, this error message was caused by using ssl.Purpose.CLIENT_AUTH
instead of ssl.Purpose.SERVER_AUTH
in my ssl.create_default_context()
arguments. Clients should use ssl.Purpose.SERVER_AUTH
because they are authorizing the servers they are communicating with, not ssl.Purpose.CLIENT_AUTH
, and vice versa for servers.
import socket
import ssl
ME_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sslContext = ssl.create_default_context(purpose = ssl.Purpose.SERVER_AUTH, cafile = 'C://...//CACert.pem', capath = None, cadata = None)
sslContext.load_cert_chain(certfile = 'C://...//serverCert.pem')
ME_SSL = sslContext.wrap_socket(ME_socket, server_side = False, server_hostname = 'MY_IP')