Removed unused imports; whitespace normalization
Change-Id: I5e66c170e37f1382ec500cd6ae4a71435de7929f
This commit is contained in:
parent
a8a6ab0264
commit
c3bc09620a
@ -14,7 +14,6 @@ class Client(object):
|
||||
self.base_url = "http://%s:%s/%s" % (host, port, base_url)
|
||||
|
||||
def poll_request(self, method, url, check_response, **kwargs):
|
||||
|
||||
timeout = kwargs.pop('timeout', 180)
|
||||
interval = kwargs.pop('interval', 2)
|
||||
# Start timestamp
|
||||
@ -29,13 +28,11 @@ class Client(object):
|
||||
time.sleep(interval)
|
||||
|
||||
def poll_request_status(self, method, url, status=200, **kwargs):
|
||||
|
||||
def check_response(resp, body):
|
||||
return resp['status'] == str(status)
|
||||
|
||||
self.poll_request(method, url, check_response, **kwargs)
|
||||
|
||||
|
||||
def request(self, method, url, **kwargs):
|
||||
# Default to management_url, but can be overridden here
|
||||
# (for auth requests)
|
||||
|
@ -1,6 +1,4 @@
|
||||
import json
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
import kong.common.http
|
||||
from kong import exceptions
|
||||
@ -24,7 +22,7 @@ class API(kong.common.http.Client):
|
||||
self.user = user
|
||||
self.api_key = api_key
|
||||
self.project_id = project_id
|
||||
# Default to same as base_url, but will be change on auth
|
||||
# Default to same as base_url, but will be changed for auth
|
||||
self.management_url = self.base_url
|
||||
|
||||
def authenticate(self, user, api_key, project_id):
|
||||
@ -104,7 +102,7 @@ class API(kong.common.http.Client):
|
||||
project_id = kwargs.get('project_id', self.project_id)
|
||||
|
||||
headers['X-Auth-Token'] = self.authenticate(self.user, self.api_key,
|
||||
self.project_id)
|
||||
project_id)
|
||||
kwargs['headers'] = headers
|
||||
return super(API, self).request(method, url, **kwargs)
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
import gettext
|
||||
import heapq
|
||||
import os
|
||||
import unittest
|
||||
|
Loading…
Reference in New Issue
Block a user