Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def join(self, digest, refresh=True):
d1 = http.request(
url=b"https://sessionserver.mojang.com/session/minecraft/join",
timeout=self.timeout,
err_type=AuthException,
data={
"accessToken": self.access_token,
"selectedProfile": self.uuid.to_hex(with_dashes=False),
"serverId": digest})
if not refresh:
return d1
else:
d0 = defer.Deferred()
def _errback(err):
self.refresh().chainDeferred(
self.join(digest, refresh=False).chainDeferred(d0))
def _request(cls, endpoint, **data):
return http.request(
url=b"https://authserver.mojang.com/"+endpoint,
timeout=cls.timeout,
err_type=ProfileException,
data=data)
def has_joined(timeout, digest, display_name, remote_host=None):
url = b"https://sessionserver.mojang.com/session/minecraft/hasJoined" + \
b"?username=" + display_name.encode('ascii') + \
b"&serverId=" + digest.encode('ascii')
if remote_host is not None:
url += b"&ip=" + remote_host.encode('ascii')
return http.request(
url=url,
timeout=timeout,
err_type=AuthException,
expect_content=True)