Update arbitrary request example to follow better practices

This commit is contained in:
Ammar Askar 2015-03-22 03:44:45 +05:00
parent 41d8e0a0c4
commit c7b71d87a7
2 changed files with 11 additions and 9 deletions

View File

@ -48,10 +48,11 @@ You may make any arbitary request to the Yggdrasil service with
---------------
An example of making an arbitary request can be seen here::
url = "https://sessionserver.mojang.com/session/minecraft/join"
server_id = encryption.generate_verification_hash(packet.server_id, secret, packet.public_key)
url = authentication.BASE_URL + "session/minecraft/join"
server_id = encryption.generate_verification_hash(packet.server_id, secret, packet.public_key)
payload = {'accessToken': self.connection.login_response.access_token,
'selectedProfile': self.connection.login_response.profile_id,
'serverId': server_id}
response = authentication.make_request(url, {'accessToken': self.connection.login_response.access_token,
'selectedProfile': self.connection.login_response.profile_id,
'serverId': server_id})
authentication.make_request(url, payload)

View File

@ -250,12 +250,13 @@ class LoginReactor(PacketReactor):
# A server id of '-' means the server is in offline mode
if packet.server_id != '-':
url = "https://sessionserver.mojang.com/session/minecraft/join"
url = authentication.BASE_URL + "session/minecraft/join"
server_id = encryption.generate_verification_hash(packet.server_id, secret, packet.public_key)
payload = {'accessToken': self.connection.login_response.access_token,
'selectedProfile': self.connection.login_response.profile_id,
'serverId': server_id}
authentication.make_request(url, {'accessToken': self.connection.login_response.access_token,
'selectedProfile': self.connection.login_response.profile_id,
'serverId': server_id})
authentication.make_request(url, payload)
encryption_response = EncryptionResponsePacket()
encryption_response.shared_secret = encrypted_secret