コード例 #1
0
    def token_post(self, url, payload, headers={}, **kwargs):
        """Mock the request for an OAuth token.
        """

        self.access_token_requests.append((url, payload, headers, kwargs))
        response = self.access_token_response
        return HTTP._process_response(url, response, **kwargs)
コード例 #2
0
 def _request_with_timeout(self, method, url, *args, **kwargs):
     self.requests.append([method, url, args, kwargs])
     response = self.responses.pop()
     return HTTP._process_response(
         url, response, kwargs.get('allowed_response_codes'),
         kwargs.get('disallowed_response_codes')
     )
コード例 #3
0
 def _make_request(self, url, *args, **kwargs):
     response = self.responses.pop()
     self.requests.append((url, args, kwargs))
     return HTTP._process_response(
         url, response, kwargs.get('allowed_response_codes'),
         kwargs.get('disallowed_response_codes')
     )
コード例 #4
0
 def _request_with_timeout(self, method, url, *args, **kwargs):
     self.requests.append([method, url, args, kwargs])
     response = self.responses.pop()
     return HTTP._process_response(
         url, response, kwargs.get('allowed_response_codes'),
         kwargs.get('disallowed_response_codes')
     )
コード例 #5
0
ファイル: enki.py プロジェクト: NYPL-Simplified/circulation
 def _request(self, method, url, headers, data, params, **kwargs):
     """Override EnkiAPI._request to pull responses from a
     queue instead of making real HTTP requests
     """
     self.requests.append([method, url, headers, data, params, kwargs])
     response = self.responses.pop()
     return HTTP._process_response(
         url, response, kwargs.get('allowed_response_codes'),
         kwargs.get('disallowed_response_codes'),
     )
コード例 #6
0
 def _request(self, method, url, headers, data, params, **kwargs):
     """Override EnkiAPI._request to pull responses from a
     queue instead of making real HTTP requests
     """
     self.requests.append([method, url, headers, data, params, kwargs])
     response = self.responses.pop()
     return HTTP._process_response(
         url, response, kwargs.get('allowed_response_codes'),
         kwargs.get('disallowed_response_codes'),
     )
コード例 #7
0
ファイル: odl.py プロジェクト: datalogics-dans/circulation
 def _get(self, url, headers=None):
     self.requests.append([url, headers])
     response = self.responses.pop()
     return HTTP._process_response(url, response)