pyknuddels/test.py
Kumi 3473e6ed6d
Add initial project structure with Knuddels API integration
Introduced the foundational codebase for a new Python wrapper to interact with the Knuddels.de API. This includes a .gitignore file to exclude virtual environments and compiled Python files, basic project metadata in pyproject.toml, and license information. Core functionality is added in the `api.py` file within a `Knuddels` class, enabling login, session handling, and GraphQL queries for message management. Accompanying `users.py` and `messages.py` modules define relevant data classes. Also set up a test script to verify login and data retrieval flows.
2024-01-13 16:46:59 +01:00

22 lines
No EOL
590 B
Python

import logging
import os
logging.basicConfig(
format="[%(asctime)s] [%(levelname)s] %(message)s",
datefmt="%d.%m.%Y %H:%M:%S",
level=logging.INFO
)
from pyknuddels.classes.api import Knuddels
from pyknuddels.classes.messages import Conversation, Message
knuddels = Knuddels(os.environ["KN_USER"], os.environ["KN_PASSWORD"])
knuddels.login()
conversations = knuddels.messenger_overview(1)
for conversation in conversations:
obj = knuddels.get_conversation(conversation["id"])
obj = Conversation.from_dict(conversation)
print(obj)