#coding=utf-8
#author='Shichao-Dong'

import requests

def client_getProductTypes():

    url="http://172.31.3.73:8888/client/v1/clientAuth.action"
    headers={"Connection": "keep-alive",
        # "Referer": "http://172.31.3.73:6020/layout_new/login.jsp?url=http://172.31.3.73:6020/layout_new/login.html",
        #"Accept-Language": "zh-CN",
        #"x-requested-with": "XMLHttpRequest",
        "Content-Type": "application/x-www-form-urlencoded",
        "Accept-Encoding": "gzip",
        #"Pragm": "=no-cache",
        #"Accept": "application/json, text/javascript, */*; q=0.01",
        "User-Agent": "waiqin_android_5216010622618132075",
        "Content-Length": "475",
        "Host": "172.31.3.73:8888",
        #"clientid": "gaeaclient-android-000004-001002",
        #"clientver": "5.7.5",
        #"cmd": "STATUSREPORT",
        "wq-lang":"zh_CN",
        #"zt": "gzip"
    }
    data={"info.versioncode":"201017",
      "info.clientVer":"5.7.5",
      "info.os":"Android 6.0",
      "info.clientId":"gaeaclient-android-000004-001002",
      "info.md5":"e95d7df6d46d167ce6984b5ca348eb22",
      "info.esn":"352591070002482",
      "info.tenantCode":"dongshichao",
      "info.userCode":"dong001",
      "info.phoneModel":"infocus m535",
      "info.appVer":"1.2.18.0",
      "info.screenheight":"1184",
      "info.simCardNum":"2",
      "info.password":"048b62076a732069",
      "info.appId":"waiqin365@zhangkong",
      "info.imsi":"X0000000000100X",
      "info.type":"1",
      "info.screenwidth":"720"
    }
    r=requests.post(url=url,headers=headers,data=data)
    cookie=r.cookies.get_dict()
    cookie1="WQSESSIONID="+"".join(cookie["WQSESSIONID"])

    url2="http://172.31.3.73:8888/app/bas_pd/client/v1/getProductTypes.action"
    headers1={"Connection": "keep-alive",
        #"Referer": "http://172.31.3.73:6020/layout_new/login.html",
        "Accept-Language": "zh-CN,zh;q=0.8",
        #"x-requested-with": "XMLHttpRequest",
        "Content-Type": "application/x-www-form-urlencoded",
        "Accept-Encoding": "gzip,deflate,sdch",
        #"Pragm": "=no-cache",
        #"Accept": "application/json, text/javascript, */*; q=0.01",
        "User-Agent": "waiqin_android_5216010622618132075",
        #"Content-Length": "475",
        "Host": "172.31.3.73:8888",
        #"clientid": "gaeaclient-android-000004-001002",
        #"clientver": "5.7.5",
        #"cmd": "STATUSREPORT",
        #"wq-lang":"zh_CN",
        #"zt": "gzip"
        "Coolie":cookie1
    }
    data1={"condition.parent_id":"1"
    }
    r1=requests.post(url=url2,headers=headers1,data=data1)

    print r1.content

if __name__=="__main__":
    
client_getProductTypes()