Exemplo n.º 1
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)
Exemplo n.º 2
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)
Exemplo n.º 3
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)
Exemplo n.º 4
0
 def _create_code_(self):
     data = {
         'path': self.path,
         'method': self.method,
         'time': DateParser.parse_stamp(DateParser.now())
     }
     return EncryptParser.sha3_256_str(json.dumps(data))
Exemplo n.º 5
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)
Exemplo n.º 6
0
 def _manage_expire_redis_key(key, mobile):
     r = redis.Redis(host='118.31.42.204',
                     port=6379,
                     db=20,
                     password="******")
     expire_redis_key = 'nest_expire_manager_1.0_permanent'
     count_redis_key = 'nest_user_sms_count_1.0_hash'
     r.hset(
         expire_redis_key, key + "@" + mobile,
         DateParser.parse_stamp(DateOperator.add_days(DateParser.now(), 1)))
     r.hset(count_redis_key, mobile, "0")
Exemplo n.º 7
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)
Exemplo n.º 8
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)
Exemplo n.º 9
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)
Exemplo n.º 10
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)
Exemplo n.º 11
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)
Exemplo n.º 12
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)