fix: Move decorator out of class definition since it is static

This patch fixes a pylint error in one of the functional tests.

Change-Id: Ie90fb475f0861445d367e65ab38f8a2555c1a0ed
This commit is contained in:
kgriffs
2014-01-22 15:40:26 -06:00
parent 5bcdc9a7cd
commit 2bdeca78e4

View File

@@ -19,6 +19,22 @@ import json
import requests
def _build_url(method):
@functools.wraps(method)
def wrapper(self, url='', **kwargs):
if not url.startswith("http"):
if not self.base_url:
raise RuntimeError("Base url not set")
url = self.base_url + url or ''
return method(self, url, **kwargs)
return wrapper
class Client(object):
def __init__(self):
@@ -31,19 +47,6 @@ class Client(object):
def set_headers(self, headers):
self.session.headers.update(headers)
def _build_url(method):
@functools.wraps(method)
def wrapper(self, url='', **kwargs):
if not url.startswith("http"):
if not self.base_url:
raise RuntimeError("Base url not set")
url = self.base_url + url or ''
return method(self, url, **kwargs)
return wrapper
@_build_url
def get(self, url=None, **kwargs):
"""Does http GET."""