Created
October 6, 2012 18:21
-
-
Save troyscott/3845703 to your computer and use it in GitHub Desktop.
Lord of Ultima Python Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import httplib2 | |
from urllib import urlencode | |
import json | |
url_login = "https://www.lordofultima.com/en/user/login" | |
url_main = "http://prodgame05.lordofultima.com/197/" | |
url_game = "%sindex.asp" % (url_main) | |
url_ajax = "%sPresentation/Service.svc/ajaxEndpoint/" % (url_main) | |
url_server_info = "%sGetServerInfo" % (url_ajax) | |
sessionId = "" | |
user_mail = "" | |
user_password = "" | |
content_type = {'content-type':'application/json'} | |
def login(): | |
h = httplib2.Http() | |
data = dict(mail=user_mail, password=user_password) | |
resp = h.request(url_login, urlencode(data)) | |
return resp | |
def getSessionId(): | |
pass | |
def getServerInfo(): | |
h = httplib2.Http() | |
data = '{"session":"%s"}' % sessionId | |
data = json.dumps({"session": sessionId}) | |
resp = h.request(url_server_info, "POST", body=data, headers=content_type) | |
return resp | |
if __name__ == "__main__": | |
print 'Test Module ....' | |
print getServerInfo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment