コード例 #1
0
    def __send_request(self, method, url, action, **kwargs):
        headers = utils.xml_content_headers(len(kwargs['data']), action)

        request_url = utils.get_request_url(
            url, self.auth.instance_url, self.url_resources.get_resource_url())

        return utils.send_request(method, self.httplib, request_url, headers,
                                  **kwargs)
コード例 #2
0
    def __send_request(self, method, url, action, **kwargs):
        headers = utils.xml_content_headers(len(kwargs['data']), action)

        request_url = utils.get_request_url(url, self.auth.instance_url, self.url_resources.get_resource_url())

        return utils.send_request(method,
                                  self.httplib,
                                  request_url,
                                  headers,
                                  **kwargs)
コード例 #3
0
    def authenticate(self):
        login_url = self.__get_token_endpoint()
        data = self.__get_params()
        headers = utils.xml_content_headers(len(data), "login")

        response = utils.send_request("POST", self.httplib, login_url, headers, data=data)

        xml_value = xml.dom.minidom.parseString(response.text)
        access_token = utils.get_element_by_name(xml_value, "sessionId")
        url = urlparse(utils.get_element_by_name(xml_value, "serverUrl"))
        instance_url = "{0}://{1}".format(url.scheme, url.netloc)

        return Authentication(access_token, instance_url)
コード例 #4
0
    def authenticate(self):
        login_url = self.__get_token_endpoint()
        data = self.__get_params()
        headers = utils.xml_content_headers(len(data), 'login')

        response = utils.send_request('POST',
                                      self.httplib,
                                      login_url,
                                      headers,
                                      data=data)

        xml_value = xml.dom.minidom.parseString(response.text)
        access_token = utils.get_element_by_name(xml_value, 'sessionId')
        url = urlparse(utils.get_element_by_name(xml_value, 'serverUrl'))
        instance_url = '{0}://{1}'.format(url.scheme, url.netloc)

        return Authentication(access_token, instance_url)