예제 #1
0
def test_html():
    # ip = r'192.168.1.62:8280'
    # ip1 = 'localhost:8080'
    #  url = 'http://192.168.1.62:8080/muleApi/api/mule/v1/user/modify_personal_info'
    url = 'http://www.baidu.com'
    hc = HttpUtil.SimpleHttpClient(url)
    hs = hc.execute()
    if hs.reason is True and hs.status is 200:
        print(hs.data)
    else:
        print('http request failure, %s,%s' % (hs.status, hs.message))
예제 #2
0
파일: aa.py 프로젝트: yongmeibian/Demos
 def do_in_action(self):
     url = 'https://bkcln.mo9.com/genieApi/api/genie/v1/coupon/lucky_draw'
     method = 'POST'
     data = {"mobile": self.mobile}
     headers = {'Content-Type': "application/json"}
     hc = HttpUtil.SimpleHttpClient(url, method, headers, data)
     hs = hc.execute()
     if hs.reason is True and hs.status is 200:
         print(hs.data)
     else:
         print('http request failure, %s,%s' % (hs.status, hs.message))
     return ""
예제 #3
0
def statistics_search():
    # url = 'http://localhost:8080/bk/api/genie/v1/statistics/search'
    # url = 'https://bkcln.mo9.com/genieApi/bk/api/genie/v1/statistics/search'
    url = 'https://bkcln.mo9.com/genieApi/bk/api/genie/v1/statistics/search'
    method = 'GET'
    headers = {
        'Ticket': 'sss',
        'User-Id': "274"
    }
    hc = HttpUtil.SimpleHttpClient(url, method, headers)
    hs = hc.execute()
    if hs.reason is True and hs.status is 200:
        print(hs.data)
    else:
        print('http request failure, %s,%s' % (hs.status, hs.message))
예제 #4
0
def modify_user_info():
    # ip = r'192.168.1.62:8280'
    # ip1 = 'localhost:8080'
    #  url = 'http://192.168.1.62:8080/muleApi/api/mule/v1/user/modify_personal_info'
    url = 'http://localhost:8080/api/mule/v1/user/modify_personal_info'
    method = 'POST'
    access_token = '2c7805d64d2e84fc14e2cd8bca91e0d8d909774d'
    user_id = '78'
    data = {'birthday': get_timestamp()}
    headers = {
        'Access-Token': access_token,
        'Current-User-Id': user_id,
        'Content-Type': "application/json"
    }
    hc = HttpUtil.SimpleHttpClient(url, method, headers, data)
    hs = hc.execute()
    if hs.reason is True and hs.status is 200:
        print(hs.data)
    else:
        print('http request failure, %s,%s' % (hs.status, hs.message))
예제 #5
0
def order_callback():
    # ip = r'192.168.1.62:8280'
    # ip1 = 'localhost:8080'
    #  url = 'http://192.168.1.62:8080/muleApi/api/mule/v1/user/modify_personal_info'
    url = 'http://localhost:8080/api/mule/v1/member/order_callback'
    method = 'POST'
    post_data = {"amount": "0.01",  # 金额
                 "topuporderDealcode": "WDAEQCFONCORCOAD",  # 第三方订单号
                 "channel": "yilianh5",  # 第三方渠道
                 "dealcode": "150408407489400983",  # 交易订单号
                 "status": "success"}  # 交易状态
    post_data_str = json.dumps(post_data)
    sign_data = str('postData=' + post_data_str + "643138394F10DA5E9647709A3FA8DD7F")
    sign = hashlib.md5(sign_data.encode("utf8"))
    sign_data = str('postData=' + post_data_str + "&") + str('sign=' + sign.hexdigest() + "&")
    url = url + '?' + sign_data
    hc = HttpUtil.SimpleHttpClient(url, method)
    hs = hc.execute()
    if hs.reason is True and hs.status is 200:
        print(hs.data)
    else:
        print('http request failure, %s,%s' % (hs.status, hs.message))