basic challenge done

Signed-off-by: Jan Heise <heise@dresearch.de>
This commit is contained in:
Jan Heise
2022-04-19 11:52:13 +02:00
parent c1a5a8bb58
commit cfb3311c34
5 changed files with 75 additions and 22 deletions

View File

@@ -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