How to use the quarry.net.http.request function in quarry

To help you get started, we’ve selected a few quarry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github barneygale / quarry / quarry / net / auth.py View on Github external
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))
github barneygale / quarry / quarry / net / auth.py View on Github external
def _request(cls, endpoint, **data):
        return http.request(
            url=b"https://authserver.mojang.com/"+endpoint,
            timeout=cls.timeout,
            err_type=ProfileException,
            data=data)
github barneygale / quarry / quarry / net / auth.py View on Github external
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)