Skip to content

Commit

Permalink
Merge branch 'feature/request-process' into master-2
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkuty committed Nov 9, 2015
2 parents 707050f + 3360508 commit 5b2d8f5
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions horizon_contrib/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,22 @@ def process_data(self, result, request):
'''process result and returns data'''
return result

def process_headers(self, headers, request):
'''process headers for example add auth headers'''
return headers

def process_params(self, params, request):
'''process params'''
return params

def process_method(self, method, request):
'''process method'''
return method

def process_url(self, url, request):
'''process url'''
return url

def request(self, path, method="GET", params={}, request={}, headers={}):
"""main method which provide
Expand Down Expand Up @@ -109,10 +125,10 @@ def request(self, path, method="GET", params={}, request={}, headers={}):

# do request
response = self.do_request(
'%s%s' % (self.api, path),
method,
params,
headers)
self.process_url('%s%s' % (self.api, path), _request),
self.process_method(method, _request),
self.process_params(params, _request),
self.process_headers(headers, _request))

# process response
result = self.process_response(response, _request)
Expand Down

0 comments on commit 5b2d8f5

Please sign in to comment.