For AI agents: this page in Markdown: https://www.pubnub.com/docs/sdks/asyncio/troubleshoot.md. Documentation index: https://www.pubnub.com/llms-full.txt.

Troubleshooting Python-Asyncio SDK

This page explains how to find the version of the PubNub Python-Asyncio Software Development Kit (SDK) and how to log it for troubleshooting and support.

How to find the version of your SDK​

Knowing your Software Development Kit (SDK) version helps with troubleshooting and reporting bugs. You can access the SDK version using the SDK_VERSION constant.

Access your SDK version via constant​

The following snippet demonstrates how to retrieve and display the SDK version using the PubNubAsyncio class.

Steps to access the SDK version​

  1. Import the required modules.
  2. Retrieve the version with PubNubAsyncio.SDK_VERSION.
  3. Log or print the version for future reference.
1import asyncio
2import os
3from pubnub.pnconfiguration import PNConfiguration
4from pubnub.pubnub_asyncio import PubNubAsyncio
5
6
7async def display_sdk_info(pubnub: PubNubAsyncio):
8 # Get and display the SDK version
9 sdk_version = PubNubAsyncio.SDK_VERSION
10 print(f"PubNub Asyncio SDK Version: {sdk_version}")
11
12
13if __name__ == "__main__":
14 # Configuration for PubNub instance
15 pn_config = PNConfiguration()
show all 33 lines

Once you retrieve the SDK version, you can use this information for several tasks. For example:

  • Reporting issues to support
  • Diagnosing compatibility problems
  • Verifying if a specific feature is available
  • Checking if your application needs an upgrade

Log the SDK version during initialization​

You can also log the SDK version during initialization to keep a record of versions used across deployments.

1import os
2import logging
3import asyncio
4from pubnub import set_stream_logger
5from pubnub.pnconfiguration import PNConfiguration
6from pubnub.pubnub_asyncio import PubNubAsyncio
7
8# Set up logging
9logging.basicConfig(level=logging.INFO)
10set_stream_logger('pubnub', logging.INFO)
11logger = logging.getLogger('pubnub_app')
12
13async def init_and_log_version(pubnub):
14 logger.info(f"Initializing PubNub with SDK version: {PubNubAsyncio.SDK_VERSION}")
15
show all 43 lines

Was this page useful?

Last updated on