Beispiel #1
0
 def login_by_password(self, mobile, password):
     params = {'mobile': mobile, 'password': password}
     timestamp = DateParser.parse_stamp(DateParser.now())
     sign = self.create_sso_sign(str(params), timestamp, None)
     headers = {
         'Client-Id': '401',
         'Client-Version': '0',
         'Language': 'cn',
         'Country': 'CN',
         'Content-Type': 'application/json',
         'Device-Id': 'chiputaobutuputaopi',
         'Timestamp': str(timestamp),
         'Sign': str(sign)
     }
     url = self.base_url + "/auth/login_by_password"
     method = 'POST'
     print("===================请求地址:%s" % url)
     print("===================请求参数:%s" % params)
     print("===================请求签名:%s" % str(sign))
     hc = SimpleHttpClient(url, method, headers, params, 10)
     hs = hc.execute()
     if hs.reason is True and hs.status == 200:
         print("===================返回结果:%s" % hs.data)
         return hs.data
     else:
         print('===================http request failure, %s' % hs.message)
Beispiel #2
0
 def find_applicable_member_cards(self, account_code, access_token):
     timestamp = DateParser.parse_stamp(DateParser.now())
     sign = self.create_sso_sign("", timestamp, access_token)
     headers = {
         'Client-Id': '401',
         'Client-Version': '0',
         'Language': 'cn',
         'Country': 'CN',
         'Content-Type': 'application/json',
         'Device-Id': 'chiputaobutuputaopi',
         'Account-Code': account_code,
         'Access-Token': access_token,
         'Timestamp': str(timestamp),
         'Sign': str(sign)
     }
     url = self.base_url + "/member/card/find_applicable_member_cards"
     method = 'GET'
     print("===================请求地址:%s" % url)
     print("===================请求签名:%s" % str(sign))
     hc = SimpleHttpClient(url, method, headers, None, 10)
     hs = hc.execute()
     if hs.reason is True and hs.status == 200:
         print("===================返回结果:%s" % hs.data)
         return hs.data
     else:
         print('===================http request failure, %s' % hs.message)
Beispiel #3
0
 def register(self):
     password = '******'
     # self.set_register_verify_code(self.mobile, code)
     self.send_register_code()
     code = self.get_sms_code(2)
     params = {'mobile': self.mobile, 'code': code, 'password': password}
     timestamp = DateParser.parse_stamp(DateParser.now())
     sign = self.create_sso_sign(str(params), timestamp, None)
     headers = {
         'Client-Id': '302',
         'Client-Version': '0',
         'Language': 'in',
         'Country': 'ID',
         'Device-Id': 'chiputaobutuputaopi',
         'Timestamp': str(timestamp),
         'Sign': str(sign)
     }
     url = self.base_url + "/auth/register"
     method = 'POST'
     print(url)
     hc = SimpleHttpClient(url, method, headers, params, 10)
     hs = hc.execute()
     if hs.reason is True and hs.status == 200:
         print(hs.data)
     else:
         print('http request failure, %s' % hs.message)
Beispiel #4
0
 def repay(self, account_code, access_token, order_no):
     params = {
         'channelType': 3,
         'bankCard': '6222021108004122255',
         'bankMobile': '15601596366',
         'orderNo': order_no,
         'userName': '',
         'idCard': ''
     }
     timestamp = DateParser.parse_stamp(DateParser.now())
     sign = self.create_sso_sign(params, timestamp, access_token)
     headers = {
         'Client-Id': '401',
         'Client-Version': '0',
         'Language': 'cn',
         'Country': 'CN',
         'Content-Type': 'application/json',
         'Device-Id': 'chiputaobutuputaopi',
         'Account-Code': account_code,
         'Access-Token': access_token,
         'Timestamp': str(timestamp),
         'Sign': str(sign)
     }
     url = self.base_url + "/cash/repay"
     method = 'POST'
     hc = SimpleHttpClient(url, method, headers, params, 40)
     hs = hc.execute()
     if hs.reason is True and hs.status == 200:
         print("===================返回结果:%s" % hs.data)
     else:
         print('===================http request failure, %s' % hs.message)
Beispiel #5
0
 def get_sms_code(self, sms_type):
     url = self.nest_url + 'find_captcha?mobileCode=' + self.mobile[:4] \
           + '&mobile=' + self.mobile[4:] + '&smsType=' + str(sms_type) + '&token=Mo92017'
     method = 'GET'
     print(url)
     hc = SimpleHttpClient(url, method)
     hs = hc.execute()
     if hs.reason is True and hs.status == 200:
         return hs.data['data']['captcha']
     else:
         print('http request failure, %s' % hs.message)
Beispiel #6
0
 def logout(self):
     timestamp = DateParser.parse_stamp(DateParser.now())
     sign = self.create_sso_sign("", timestamp, self.access_token)
     self.heads['Timestamp'] = str(timestamp)
     self.heads['Sign'] = str(sign)
     url = self.base_url + "/user/logout"
     method = 'POST'
     hc = SimpleHttpClient(url, method, self.heads, None, 10)
     hs = hc.execute()
     if hs.reason is True and hs.status == 200:
         print(hs.data)
     else:
         print('http request failure, %s' % hs.message)
Beispiel #7
0
 def modify_password(self):
     params = {'password': '******', 'newPassword': '******'}
     timestamp = DateParser.parse_stamp(DateParser.now())
     sign = self.create_sso_sign(params, timestamp, self.access_token)
     self.heads['Timestamp'] = str(timestamp)
     self.heads['Sign'] = str(sign)
     url = self.base_url + "/user/modify_password"
     method = 'POST'
     hc = SimpleHttpClient(url, method, self.heads, params, 10)
     hs = hc.execute()
     if hs.reason is True and hs.status == 200:
         print(hs.data)
     else:
         print('http request failure, %s' % hs.message)
Beispiel #8
0
 def submit_account_info(self):
     timestamp = DateParser.parse_stamp(DateParser.now())
     sign = self.create_sso_sign("", timestamp, self.access_token)
     self.heads['Timestamp'] = str(timestamp)
     self.heads['Sign'] = str(sign)
     self.heads['Content-Type'] = 'application/json'
     url = self.base_url + "/user/submit_account_info"
     method = 'POST'
     hc = SimpleHttpClient(url, method, self.heads, None, 10)
     hs = hc.execute()
     if hs.reason is True and hs.status == 200:
         print(hs.data)
     else:
         print('http request failure, %s' % hs.message)
Beispiel #9
0
 def modify_bank_card_info(self):
     params = {
         'cardName': '629sadd516',
         'bankName': '6292666516',
         'bankAccount': "123123123"
     }
     timestamp = DateParser.parse_stamp(DateParser.now())
     sign = self.create_sso_sign(params, timestamp, self.access_token)
     self.heads['Timestamp'] = str(timestamp)
     self.heads['Sign'] = str(sign)
     self.heads['Content-Type'] = 'application/json'
     url = self.base_url + "/user/modify_bank_card_info"
     method = 'POST'
     print(params)
     hc = SimpleHttpClient(url, method, self.heads, params, 10)
     hs = hc.execute()
     if hs.reason is True and hs.status == 200:
         print(hs.data)
     else:
         print('http request failure, %s' % hs.message)
Beispiel #10
0
 def send_login_code(self):
     params = {'mobile': self.mobile}
     timestamp = DateParser.parse_stamp(DateParser.now())
     sign = self.create_sso_sign(str(params), timestamp, None)
     headers = {
         'Client-Id': '302',
         'Client-Version': '0',
         'Language': 'in',
         'Country': 'ID',
         'Device-Id': 'chiputaobutuputaopi',
         'Timestamp': str(timestamp),
         'Sign': str(sign)
     }
     url = self.base_url + "/auth/send_login_code"
     method = 'POST'
     hc = SimpleHttpClient(url, method, headers, params, 10)
     hs = hc.execute()
     if hs.reason is True and hs.status == 200:
         print(hs.data)
     else:
         print('http request failure, %s' % hs.message)
Beispiel #11
0
#     dcap["phantomjs.page.settings.userAgent"] = ua.chrome
#     driver = webdriver.PhantomJS(executable_path=path, desired_capabilities=dcap)
#     driver.get(url)
#     print(driver.page_source)
#     # hc = SimpleHttpClient(url, method, headers, params, 10)
#     # hs = hc.execute()
#     # if hs.reason is True and hs.status == 200:
#     #     print("===================返回结果:%s" % hs.data)
#     #     return hs.data
#     # else:
#     #     print('===================http request failure, %s' % hs.message)
#
#
# url = 'http://localhost:8090'
# mobile = '008615601596366'
# password = '******'
# http_request(url, mobile, password)
# ----------------------------------
# from selenium import webdriver
#
# path = 'D:/Program Files/phantomjs-2.1.1-windows/bin/phantomjs'
# driver = webdriver.PhantomJS(executable_path=path)
# driver.get("https://www.whatismybrowser.com/")
# ----------------------------------
from util.HttpUtil import SimpleHttpClient

url = 'https://www.whatismybrowser.com/'
client = SimpleHttpClient(url, timeout=10)
result = client.execute()
print(result.data)
Beispiel #12
0
 def demo1(url):
     shClient = SimpleHttpClient(url)
     return shClient.execute()
Beispiel #13
0
 def modify_info(self):
     # params = {
     #     'baseInfo': {
     #         'address': 'aaaaaaaaaa',
     #         'mobile': '008615601596366',
     #         'regionInfo': {
     #             'cityId': 3,
     #             'regionId': 4,
     #             'streetId': 5
     #         }
     #     },
     #     'certifyInfo': {
     #         'realName': 'bbb',
     #         'idCard': '62'+self.mobile,
     #         'accountFrontImg': 'https://secure.gravatar.com/avatar/601dc2b900c17ca9c9633ebd845eb008?s=32&d=identicon',
     #         'accountBackImg': 'https://secure.gravatar.com/avatar/601dc2b900c17ca9c9633ebd845eb008?s=32&d=identicon',
     #         'accountOcr': 'https://secure.gravatar.com/avatar/601dc2b900c17ca9c9633ebd845eb008?s=32&d=identicon'
     #     },
     #     'jobInfo': {
     #         'companyName': 'cccc',
     #         'industry': 2,
     #         'department': 2,
     #         'position': 3,
     #         'address': 'dddd',
     #         'companyTel': '161654156714',
     #         'employeeCardUrl': 'https://secure.gravatar.com/avatar/601dc2b900c17ca9c9633ebd845eb008?s=32&d=identicon',
     #         'regionInfo': {
     #             'cityId': 3,
     #             'regionId': 4,
     #             'streetId': 5
     #         }
     #     },
     #     'contactInfo': {
     #         'societyContactInfo': [
     #             {
     #                 'contactType': 1,
     #                 'name': 'eeee',
     #                 'mobile': '008716015915844'
     #             },
     #             {
     #                 'contactType': 1,
     #                 'name': 'fffff',
     #                 'mobile': '008716999915844'
     #             }
     #         ]
     #     }
     # }
     params = {
         'certifyInfo': {
             'realName':
             'bbb',
             'idCard':
             '6292666516958332',
             'accountFrontImg':
             'https://secure.gravatar.com/avatar/601dc2b900c17ca9c9633ebd845eb008?s=32&d=identicon',
             'accountBackImg':
             'https://secure.gravatar.com/avatar/601dc2b900c17ca9c9633ebd845eb008?s=32&d=identicon',
             'accountOcr':
             'https://secure.gravatar.com/avatar/601dc2b900c17ca9c9633ebd845eb008?s=32&d=identicon'
         },
         'contactInfo': {
             'societyContactInfo': [{
                 'contactType': 1,
                 'name': 'eeee',
                 'mobile': '008716015915844'
             }, {
                 'contactType': 1,
                 'name': 'fffff',
                 'mobile': '008716999915844'
             }]
         }
     }
     timestamp = DateParser.parse_stamp(DateParser.now())
     sign = self.create_sso_sign(params, timestamp, self.access_token)
     self.heads['Timestamp'] = str(timestamp)
     self.heads['Sign'] = str(sign)
     self.heads['Content-Type'] = 'application/json'
     url = self.base_url + "/user/modify_info"
     method = 'POST'
     print(params)
     hc = SimpleHttpClient(url, method, self.heads, params, 10)
     hs = hc.execute()
     if hs.reason is True and hs.status == 200:
         print(hs.data)
     else:
         print('http request failure, %s' % hs.message)