This repository has been archived on 2020-09-24. You can view files and clone it, but cannot push or open issues or pull requests.
producer/messagesender.py

52 lines
1.0 KiB
Python
Raw Normal View History

2020-03-29 15:26:43 +02:00
#!/usr/bin/env python
2020-03-29 16:33:18 +02:00
# IDE JÖNNEK IMPORTOK
import random
import string
2020-03-29 15:26:43 +02:00
"""
Main Flask RESTful API
"""
__author__ = "@tormakris"
__copyright__ = "Copyright 2020, GoldenPogácsa Team"
__module_name__ = "messagesender"
__version__text__ = "1"
class MessageSender:
"""
Üzenetek küldéséért felelős komponens.
"""
2020-03-29 16:33:18 +02:00
2020-03-29 15:26:43 +02:00
def __init__(self):
"""
Inicializálja az osztályt.
"""
2020-03-29 16:33:18 +02:00
self.id = 0
2020-03-29 15:26:43 +02:00
pass
2020-03-29 16:33:18 +02:00
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:
2020-03-29 15:26:43 +02:00
"""
Ez egy metodus
:param szam:
:param szoveg:
:return: str tipus
"""
2020-03-29 16:33:18 +02:00
self.id += random.randrange(10000)
data = self.randomString(p)
return str(self.id) + " " + str(data)
pass
if __name__ == "__main__":
temp = MessageSender()
print(temp.CreateMessage(20))