Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. import httplib
  2. import urllib
  3. import urllib2
  4. import json
  5. import os
  6.  
  7. username = raw_input('Username: ')
  8. password = raw_input('Password: ')
  9.  
  10. JSONLauncherInfo = 'https://download.toontownrewritten.com/launcher/windows/ttr_launcher.json'
  11.  
  12. data = urllib2.urlopen(JSONLauncherInfo)
  13. data = json.load(data)
  14.  
  15. SSLInfo = ('www.toontownrewritten.com', 443)
  16.  
  17. connection = httplib.HTTPSConnection(*SSLInfo)
  18. headers = {'Content-type': 'application/x-www-form-urlencoded'}
  19. params = urllib.urlencode({'username': username, 'password': password})
  20. connection.request('POST', '/api/login?format=json', params, headers)
  21.  
  22. response = connection.getresponse()
  23. responseData = json.loads(response.read())
  24.  
  25. queueToken = responseData.get('queueToken', None)
  26.  
  27. connection = httplib.HTTPSConnection(*SSLInfo)
  28. headers = {'Content-type': 'application/x-www-form-urlencoded'}
  29. params = urllib.urlencode({'queueToken': queueToken})
  30. connection.request('POST', '/api/login?format=json', params, headers)
  31.  
  32. response = connection.getresponse()
  33. responseData = json.loads(response.read())
  34.  
  35. os.environ['TTR_PLAYCOOKIE'] = responseData.get('cookie', None)
  36. os.environ['TTR_GAMESERVER'] = responseData.get('gameserver', None)
  37.  
  38. from toontown.toonbase.ToontownStart import *
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement