def _urlfetch_http_request(url, method, data): from google.appengine.api import urlfetch method = method.upper() qs = urlencode(data) if method == 'POST': payload = qs else: payload = None url += '?' + qs headers = { 'User-Agent': 'Plaid Python v{}'.format(__version__) } res = urlfetch.fetch( url, follow_redirects=True, method=method, payload=payload, headers=headers, deadline=60 # seconds ) # Add consistent interface across requests library and urlfetch res.ok = res.status_code >= 200 and res.status_code < 300 res.text = res.content return res
def _urlfetch_http_request(url, method, data): from google.appengine.api import urlfetch method = method.upper() qs = urlencode(data) if method == 'POST': payload = qs else: payload = None url += '?' + qs headers = {'User-Agent': 'Plaid Python v{}'.format(__version__)} res = urlfetch.fetch( url, follow_redirects=True, method=method, payload=payload, headers=headers, deadline=60 # seconds ) # Add consistent interface across requests library and urlfetch res.ok = res.status_code >= 200 and res.status_code < 300 res.text = res.content return res
def institution_search(self, url, q=None, p=None, institution_id=None): """ Perform simple search query against Long Tail institutions. `q` str Query against the full list of institutions. `p` str Filter FIs by a single product (Optional). `institution_id` str The id of a single institution for lookup (Optional). """ assert q is not None or institution_id is not None, "query or institution_id required" params = dict( [(key, value) for key, value in [("q", q), ("p", p), ("id", institution_id)] if value is not None] ) return get_request( "{}{}{}".format(url, "?" if params else "", urlencode(params)), suppress_errors=self.suppress_http_errors )
def institution_search(self, url, q=None, p=None, institution_id=None): ''' Perform simple search query against Long Tail institutions. `q` str Query against the full list of institutions. `p` str Filter FIs by a single product (Optional). `institution_id` str The id of a single institution for lookup (Optional). ''' assert q is not None or institution_id is not None, ( 'query or institution_id required') params = dict([ (key, value) for key, value in [('q', q), ('p', p), ('id', institution_id)] if value is not None ]) return get_request('{}{}{}'.format(url, '?' if params else '', urlencode(params)), suppress_errors=self.suppress_http_errors)
def institution_search(self, url, q=None, p=None, institution_id=None): ''' Perform simple search query against Long Tail institutions. `q` str Query against the full list of institutions. `p` str Filter FIs by a single product (Optional). `institution_id` str The id of a single institution for lookup (Optional). ''' assert q is not None or institution_id is not None, ( 'query or institution_id required' ) params = dict([(key, value) for key, value in [ ('q', q), ('p', p), ('id', institution_id) ] if value is not None]) return get_request( '{}{}{}'.format(url, '?' if params else '', urlencode(params)), suppress_errors=self.suppress_http_errors )