Exemplo n.º 1
0
	def update_token(self, uid, token, refresh_token, appId=""):
		head = CONST.getHead(token, appId)
		data = {
			"uid" : uid,
			"refreshToken" : refresh_token
		}
		return requests.put(self.baseURL, params=data, headers=head)
Exemplo n.º 2
0
 def send_captcha(self,
                  mobile,
                  check_type,
                  token="token",
                  app_id=CONST.APPID):
     head = CONST.getHead(token, app_id)
     params = "mobile=" + mobile + "&checktype=" + str(check_type)
     return requests.get(self.baseUrl, params=params, headers=head)
Exemplo n.º 3
0
 def validate_captcha(self,
                      mobile,
                      captcha,
                      check_type,
                      token="token",
                      app_id=CONST.APPID):
     head = CONST.getHead(token, app_id)
     data = {"mobile": mobile, "captcha": captcha, "checkType": check_type}
     return requests.put(self.baseUrl, data=data, headers=head)
Exemplo n.º 4
0
 def unbind_mobile(self,
                   uid,
                   token="token",
                   app_id=CONST.APPID,
                   unverified="true"):
     head = CONST.getHead(token, app_id)
     params = "unverified=" + str(unverified)
     url = self.baseUrl + "/" + str(uid)
     return requests.delete(url, headers=head, params=params)
Exemplo n.º 5
0
 def bind_sub_account(self,
                      uid,
                      temp_id,
                      sub_app_id,
                      token="token",
                      app_id=CONST.APPID):
     head = CONST.getHead(token, app_id)
     data = {"uid": uid, "tempId": str(temp_id), "subAppId": sub_app_id}
     url = self.baseUrl + "/" + str(uid)
     return requests.post(url, data=data, headers=head)
Exemplo n.º 6
0
 def bind_mobile(self,
                 uid,
                 mobile,
                 token="token",
                 app_id=CONST.APPID,
                 unverified="true"):
     head = CONST.getHead(token, app_id)
     data = {"mobile": mobile, "unverified": unverified}
     url = self.baseUrl + "/" + str(uid)
     return requests.put(url, data=data, headers=head)
Exemplo n.º 7
0
 def unbind_sub_account(self,
                        uid,
                        sub_app_id,
                        sub_account,
                        token="token",
                        app_id=CONST.APPID):
     head = CONST.getHead(token, app_id)
     params = "subAppId=" + str(sub_app_id) + "&subAccount=" + sub_account
     url = self.baseUrl + "/" + str(uid)
     return requests.delete(url, params=params, headers=head)
Exemplo n.º 8
0
 def reset_password(self,
                    uid,
                    password,
                    app_id=CONST.APPID,
                    unverified="true"):
     head = CONST.getHead("token", app_id)
     if password != "":
         password = hashlib.md5(password.encode("utf8")).hexdigest()
     data = {"password": password, "unverified": unverified}
     url = self.baseUrl + "/" + str(uid)
     return requests.post(url, data=data, headers=head)
Exemplo n.º 9
0
	def login_subaccount(self, app_id, sub_app_id, sub_account):
		head = CONST.getHead("", app_id)

		timestamp = str(int(time.time()*1000))
		url = self.baseURL+"/subaccount"

		data = {
			"subaccount": sub_account,
			"subAppId": sub_app_id,
			"scope": ""
		}
		return requests.post(url, data=data, headers=head)
Exemplo n.º 10
0
	def login(self, account, pwd, app_id=''):
		head = CONST.getHead("", app_id)

		timestamp = str(int(time.time()*1000))
		pwd = Md5.encoder_pwd(pwd, account, timestamp)

		data = {
			"account": account,
			"password": pwd,
			"timestamp": timestamp,
			"scope": ""
		}
		#print(data)
		#print(head)
		return requests.post(self.baseURL, data=data, headers=head)
Exemplo n.º 11
0
    def update_user_info(self,
                         uid,
                         user_info,
                         extend_info,
                         token="token",
                         app_id=CONST.APPID):
        head = CONST.getHead(token, app_id)
        data = {
            "userInfo": AccountUtils.get_up_user_info(),
            "extendInfo": AccountUtils.get_up_extend_info()
        }
        if user_info != "":
            data["userInfo"] = user_info
        if extend_info != "":
            data["extendInfo"] = extend_info

        url = self.baseUrl + "/" + str(uid)
        return requests.put(url, data=data, headers=head)
Exemplo n.º 12
0
 def update_password(self,
                     uid,
                     old_pwd,
                     password,
                     token="token",
                     app_id=CONST.APPID,
                     unverified="true"):
     head = CONST.getHead(token, app_id)
     if old_pwd != "":
         old_pwd = hashlib.md5(old_pwd.encode("utf8")).hexdigest()
     if password != "":
         password = hashlib.md5(password.encode("utf8")).hexdigest()
     data = {
         "oldPwd": old_pwd,
         "password": password,
         "unverified": unverified
     }
     url = self.baseUrl + "/" + str(uid)
     return requests.put(url, data=data, headers=head)
Exemplo n.º 13
0
 def register(self,
              user_code,
              password,
              user_info,
              extend_info,
              app_id=CONST.APPID,
              unverified="true"):
     head = CONST.getHead("token", app_id)
     if password != "":
         password = hashlib.md5(password.encode("utf8")).hexdigest()
     data = {
         "mobile": user_code,
         "password": password,
         "userInfo": AccountUtils.get_user_info(),
         "extendInfo": AccountUtils.get_extend_info(),
         "unverified": unverified
     }
     if user_info != "":
         data["userInfo"] = user_info
     if extend_info != "":
         data["extendInfo"] = extend_info
     return requests.post(self.baseUrl, data=data, headers=head)
Exemplo n.º 14
0
 def get_status(self, uid, target_id, token="token", app_id=CONST.APPID):
     head = CONST.getHead(token, app_id)
     url = self.baseUrl + "/" + str(uid)
     params = "targetId=" + str(target_id)
     return requests.get(url, params=params, headers=head)
Exemplo n.º 15
0
 def register(self, callback_url, app_id):
     head = CONST.getHead("", app_id)
     data = {"callBackUrl": callback_url}
     return requests.post(self.baseURL, data=data, headers=head)
Exemplo n.º 16
0
 def un_register(self, app_id):
     head = CONST.getHead("", app_id)
     return requests.delete(self.baseURL, headers=head)
Exemplo n.º 17
0
 def get_binding_status(self, uid, token="token", app_id=CONST.APPID):
     head = CONST.getHead(token, app_id)
     # params = "uid=" + str(uid)
     url = self.baseUrl + "/" + str(uid)
     return requests.get(url, headers=head)
Exemplo n.º 18
0
 def enable_user(self, uid, target_id, token="token", app_id=CONST.APPID):
     head = CONST.getHead(token, app_id)
     url = self.baseUrl + "/" + str(uid)
     params = "uid=" + str(uid) + "&targetId=" + str(target_id)
     return requests.delete(url, params=params, headers=head)
Exemplo n.º 19
0
 def get_sub_account(self, sub_account, sub_app_id, app_id=CONST.APPID):
     head = CONST.getHead("", app_id)
     params = "subAccount=" + str(sub_account) + "&subAppId=" + str(
         sub_app_id)
     url = self.baseUrl
     return requests.get(url, params=params, headers=head)
Exemplo n.º 20
0
 def get_sub_account_list(self, uid, token="token", app_id=CONST.APPID):
     head = CONST.getHead(token, app_id)
     # params = "uid=" + str(uid)
     url = self.baseUrl + "/" + str(uid)
     return requests.get(url, headers=head)
Exemplo n.º 21
0
	def query(self, token):
		return requests.get(self.baseURL, headers=CONST.getHead(token))
Exemplo n.º 22
0
	def query_user(self, uid, token):
		tmp_url = "%s/%s" % (self.baseURL, uid)
		head = CONST.getHead(token)
		return requests.get(tmp_url, headers=head)
Exemplo n.º 23
0
	def logout(self, token):
		return requests.delete(self.baseURL, headers=CONST.getHead(token))
Exemplo n.º 24
0
 def clean(self):
     head = CONST.getHead("token")
     requests.delete(self.baseUrl, headers=head)
Exemplo n.º 25
0
 def disable_user(self, uid, target_id, token="token", app_id=CONST.APPID):
     head = CONST.getHead(token, app_id)
     url = self.baseUrl + "/" + str(uid)
     data = {"targetId": target_id}
     return requests.put(url, data=data, headers=head)