From 9aa3d7b637c8cdcad545a08405a0e2e02a13d8d3 Mon Sep 17 00:00:00 2001 From: Tyler Liu Date: Wed, 3 Apr 2024 15:16:03 -0700 Subject: [PATCH] Fix a KeyError --- ringcentral/demos/demo_subscription.py | 4 +++- ringcentral/websocket/web_socket_subscription.py | 2 +- setup.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ringcentral/demos/demo_subscription.py b/ringcentral/demos/demo_subscription.py index b7f2160..1dd2dbb 100755 --- a/ringcentral/demos/demo_subscription.py +++ b/ringcentral/demos/demo_subscription.py @@ -1,8 +1,10 @@ -from ringcentral import SDK from dotenv import load_dotenv import asyncio +import sys import os +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) # Add the project root to sys.path from ringcentral.websocket.events import WebSocketEvents +from ringcentral import SDK def on_notification(message): print("\n Subscription notification:\n") diff --git a/ringcentral/websocket/web_socket_subscription.py b/ringcentral/websocket/web_socket_subscription.py index f7dfe55..df9a0ad 100644 --- a/ringcentral/websocket/web_socket_subscription.py +++ b/ringcentral/websocket/web_socket_subscription.py @@ -17,7 +17,7 @@ def __init__(self, web_socket_client): def on_message(self, message): message_json = json.loads(message) - if(message_json[0]['type'] == 'ClientRequest' and message_json[0]['headers']['WSG-SubscriptionId']): + if(message_json[0]['type'] == 'ClientRequest' and 'WSG-SubscriptionId' in message_json[0]['headers']): self.set_subscription(message_json) self._web_socket_client.trigger(WebSocketEvents.subscriptionCreated, self) else: diff --git a/setup.py b/setup.py index b357905..6721f7b 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = '0.8.4' +VERSION = '0.8.5' setup( name='ringcentral',