Exemplo n.º 1
0
storage.create_db_if_none()
conn, curs = storage.get_conn_curs()
device_info = {
    "Model": "%d.%d.%d" % (pyver[0], pyver[1], pyver[2]),
    "IMEI": "123457",
    "FriendlyName": "My pyAS Client 2",
    "OS": "Python",
    "OSLanguage": "en-us",
    "PhoneNumber": "NA",
    "MobileOperator": "NA",
    "UserAgent": "pyAS"
}

#create wbxml_parser test
cp, cp_sh = as_code_pages.build_as_code_pages()
parser = wbxml_parser(cp, cp_sh)

#create activesync connector
as_conn = ASHTTPConnector(as_server)  #e.g. "as.myserver.com"
as_conn.set_credential(as_user, as_pass)
as_conn.options()
policykey = storage.get_keyvalue("X-MS-PolicyKey")
if policykey:
    as_conn.set_policykey(policykey)


def as_request(cmd, wapxml_req):
    print "\r\n%s Request:" % cmd
    print wapxml_req
    res = as_conn.post(cmd, parser.encode(wapxml_req))
    wapxml_res = parser.decode(res)
Exemplo n.º 2
0
from objects.MSASHTTP import ASHTTPConnector
from objects.MSASCMD import FolderHierarchy, as_status
from objects.MSASAIRS import airsync_FilterType, airsync_Conflict, airsync_MIMETruncation, airsync_MIMESupport, airsync_Class, airsyncbase_Type

from proto_creds import * #create a file proto_creds.py with vars: as_server, as_user, as_pass

pyver = sys.version_info

storage.create_db_if_none()
conn, curs = storage.get_conn_curs()
device_info = {"Model":"%d.%d.%d" % (pyver[0], pyver[1], pyver[2]), "IMEI":"123456", "FriendlyName":"My pyAS Client", "OS":"Python", "OSLanguage":"en-us", "PhoneNumber": "NA", "MobileOperator":"NA", "UserAgent": "pyAS"}

#create wbxml_parser test
cp, cp_sh = as_code_pages.build_as_code_pages()
parser = wbxml_parser(cp, cp_sh)

#create activesync connector
as_conn = ASHTTPConnector(as_server) #e.g. "as.myserver.com"
as_conn.set_credential(as_user, as_pass)
as_conn.options()
policykey = storage.get_keyvalue("X-MS-PolicyKey")
if policykey:
    as_conn.set_policykey(policykey)

def as_request(cmd, wapxml_req):
    print "\r\n%s Request:" % cmd
    print wapxml_req
    res = as_conn.post(cmd, parser.encode(wapxml_req))
    wapxml_res = parser.decode(res)
    print "\r\n%s Response:" % cmd