Troubleshooting Python-Asyncio SDK
How to find the version of your SDK
Knowing your SDK version is essential when troubleshooting issues or reporting bugs. You can access your SDK version using the SDK_VERSION
constant.
Access your SDK version via constant
import asyncio
import os
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub_asyncio import PubNubAsyncio
async def display_sdk_info(pubnub: PubNubAsyncio):
# Get and display the SDK version
sdk_version = PubNubAsyncio.SDK_VERSION
print(f"PubNub Asyncio SDK Version: {sdk_version}")
if __name__ == "__main__":
# Configuration for PubNub instance
pn_config = PNConfiguration()
show all 33 linesThis will return the current version string (for example, 6.2.0
). Always include this information when:
- Reporting issues to support
- Diagnosing compatibility problems
- Verifying if a specific feature is available
- Checking if your application needs an upgrade
You can also print this information in your application logs during initialization to maintain a record of the SDK version used in different deployments.
import os
import logging
import asyncio
from pubnub.pubnub import set_stream_logger # Correct import for set_stream_logger
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub_asyncio import PubNubAsyncio
# Set up logging
logging.basicConfig(level=logging.INFO)
set_stream_logger('pubnub', logging.INFO)
logger = logging.getLogger('pubnub_app')
async def init_and_log_version(pubnub):
logger.info(f"Initializing PubNub with SDK version: {PubNubAsyncio.SDK_VERSION}")
show all 43 lines