#Gears API for Geolocation import httplib, sysinfo, location def gGSMLocation((mcc, mnc, lac, cid)): conn = httplib.HTTPConnection('www.google.com') sVer = "'version': '1.0', " sRadio = "'radio': 'gsm', " sCellStart = "'cell_id_request_element': [{" sCellCID = "'cell_id':" + str(cid) + ", " sCellLAC = "'location_area_code': " + str(lac) + ", " sCellMCC = "'mobile_country_code': " + str(mcc) + ", " sCellMNC = "'mobile_network_code': " + str(mnc) sCellEnd = "}]" sOpen = "{" sClose = "}" req = sOpen + sVer + sRadio + sCellStart + sCellCID + sCellLAC + sCellMCC + sCellMNC + sCellEnd + sClose print 'Request: ', req #head = {'Content-type': 'text/javascript', 'Connection': 'close'} conn.request("POST", "/loc/json", req) response = conn.getresponse().read() conn.close() return response def gGSM: return gGSMLocation(location.gsm_location())