Commit 92c56ef6 authored by Jo Sama's avatar Jo Sama 😱
Browse files

Rewrite list_operators()

parent 65d3a82b
......@@ -3,7 +3,7 @@ import requests
from urllib.parse import urljoin, urlparse
from .model import Operator, Operators
from .model import Operator
logger = logging.getLogger(__name__)
......@@ -18,6 +18,9 @@ class Endpoints:
def get_operator(self, identity):
return urljoin(self._prepend_base_url('/operators/'), identity)
def get_operators(self):
return self._prepend_base_url('/operators/')
class TopDeskClient:
def __init__(self, url, headers=None, rewrite_url=None):
......@@ -68,7 +71,8 @@ class TopDeskClient:
return Operator.from_dict(self.get(url))
def list_operators(self):
return Operators(self.get(self.urls.get_operator()))
for x in self.get(self.urls.get_operators()):
yield Operator.from_dict(x)
def get_client(config):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment