From 3e1f331e032f5e0e3650e96db5198beafe9529a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Bence?= Date: Sun, 29 Mar 2020 16:33:18 +0200 Subject: [PATCH] MessageSender skeleton --- messagesender.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/messagesender.py b/messagesender.py index dc57c00..cd81501 100644 --- a/messagesender.py +++ b/messagesender.py @@ -1,6 +1,8 @@ #!/usr/bin/env python -#IDE JÖNNEK IMPORTOK +# IDE JÖNNEK IMPORTOK +import random +import string """ Main Flask RESTful API @@ -15,17 +17,37 @@ class MessageSender: """ Üzenetek küldéséért felelős komponens. """ + id + def __init__(self): """ Inicializálja az osztályt. """ + self.id = 0 pass - def cucc(self, szam: int, szoveg: str) -> str: + + def randomString(self, stringLength): + """Generate a random string of fixed length """ + letters = string.ascii_lowercase + return ''.join(random.choice(letters) for i in range(stringLength)) + + + def CreateMessage(self, p) -> str: """ Ez egy metodus :param szam: :param szoveg: :return: str tipus """ - pass \ No newline at end of file + self.id += random.randrange(10000) + data = self.randomString(p) + + #print(str(self.id) + " " + str(data)) + return str(self.id) + " " + str(data) + pass + + +if __name__ == "__main__": + temp = MessageSender() + print(temp.CreateMessage(20))