From 2d49939950b3c516e51bb00f178e669e5902bcc6 Mon Sep 17 00:00:00 2001 From: "gapanovichal@gmail.com" Date: Mon, 17 Jun 2024 14:52:48 -0700 Subject: [PATCH] Revert "In this version, result.get("messages", []) is used to safely retrieve the messages list or an empty list if messages is not present. Similarly, result.get("response_metadata", {}).get("next_cursor") is used to safely check for the presence of next_cursor within response_metadata." This reverts commit f5f2ce9413b6bce806e0b288fd4734126b17c1f9. --- slacker/slacker.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slacker/slacker.py b/slacker/slacker.py index 5374e2d..8930e9c 100644 --- a/slacker/slacker.py +++ b/slacker/slacker.py @@ -55,11 +55,11 @@ def read_channel(client, channel_id, rss_type, pages_to_read): try: conversation_history = [] result = client.conversations_history(channel=channel_id) - conversation_history.extend(result.get ("message",[]) + conversation_history.extend(result["messages"]) - while result.get("response_metadata",{}).get("next_cursor") and pages_to_read > 0: + while result["response_metadata"]["next_cursor"] is not None and pages_to_read > 0: result = client.conversations_history(channel=channel_id, cursor=result["response_metadata"]["next_cursor"]) - conversation_history.extend(result.get("messages", [])) + conversation_history.extend(result["messages"]) pages_to_read = pages_to_read - 1 # Process extracted messages to find links and MD5 hashes