示例#1
0
 def get_user(self, email, password):
     url = urljoin(self.user_platform_config.get_redirect_api_url(),
                   "/user/get")
     response = requests.get(url,
                             params={
                                 'email': email,
                                 'password': password
                             })
     util.check_http_error(response)
     user = convertible.from_json(response.text).data
     return user
示例#2
0
    def send_log(self, user_update_token, logs, include_support):

        url = urljoin(self.user_platform_config.get_redirect_api_url(),
                      "/user/log")
        response = requests.post(
            url, {
                'token': user_update_token,
                'data': logs,
                'include_support': include_support
            })
        util.check_http_error(response)
        user = convertible.from_json(response.text)

        return user
示例#3
0
 def acquire(self, email, password, user_domain):
     device_id = id.id()
     data = {
         'email': email,
         'password': password,
         'user_domain': user_domain,
         'device_mac_address': device_id.mac_address,
         'device_name': device_id.name,
         'device_title': device_id.title,
     }
     url = urljoin(self.user_platform_config.get_redirect_api_url(),
                   "/domain/acquire")
     response = requests.post(url, data)
     util.check_http_error(response)
     response_data = convertible.from_json(response.text)
     return response_data
示例#4
0
def check_http_error(response):
    log = logger.get_logger('util')
    if not response.status_code == 200:
        log.error(response.text)
        error = convertible.from_json(response.text)
        raise PassthroughJsonError(error.message, response.text)