24
challenge.py
24
challenge.py
@@ -3,11 +3,29 @@
|
||||
class Adapter():
|
||||
""" Adapter class
|
||||
|
||||
Aufgabe: Asynchron Daten lesen, konvertieren und zurückliefern.
|
||||
Aufgabe: Asynchron XML-Daten lesen, konvertieren und zurückliefern.
|
||||
"""
|
||||
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
|
||||
def retrieve_json(self, name):
|
||||
pass
|
||||
def retrieve_token(self, name):
|
||||
"""
|
||||
Retrieve the content from file name.xml in adapters path directory
|
||||
in a synchronous way, extract the DataReceived/Token and return it
|
||||
as a JSON-Object (stringified) '{"token": value}'.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def retrieve_token_async(self, name):
|
||||
"""
|
||||
Retrieve the content from file name.xml in adapters path directory
|
||||
in an asynchronous way, extract the DataReceived/Token and return it
|
||||
as a Deferred which ends up in a JSON-Object (as above).
|
||||
|
||||
see: https://twistedmatrix.com/documents/8.0.0/api/twisted.internet.defer.Deferred.html
|
||||
|
||||
Hint: The simple way is to use defer.succeed(), bonus points for doing
|
||||
it with a callback chain read->parse->convert.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
Reference in New Issue
Block a user