Python
Last updated
The Hackle Python SDK supports Python 3 and above.
If you are using a WSGI environment, be sure to check the WSGI Configuration guide.
pip install hackle-sdkhackle_client is a global variable and must be created only once.
hackle_client manages state internally to evaluate results immediately from threads without I/O.
This uses additional resources for that purpose.
Do not create a new instance for every request; instead, use the already-created instance.
Since hackle_client is built as a singleton object, using hackle.Client() in other functions will not recreate it.
hackle_client is the class that provides methods for using SDK features.
To use the SDK, you need to initialize hackle_client.
Instantiate hackle_client by passing the SDK Key.
hackle_client periodically synchronizes with the Hackle server as a background task to obtain the necessary information.
You can find the SDK Key in SDK Integration Info located inside the Hackle Service Dashboard.
When the application shuts down, you must shut down hackle_client using the hackle_client.close() method.
This releases resources in use and sends any remaining events.
If the application shuts down without calling hackle_client.close(), events may be lost.
You can use @atexit.register to automatically shut down hackle_client when the application exits.
Last updated
from hackle import hackle
# YOUR_SERVER_SDK_KEY 자리에 SDK 키를 넣습니다.
hackle_client = hackle.Client(sdk_key=YOUR_SERVER_SDK_KEY)hackle_client.close()import atexit
@atexit.register
def __exit__():
hackle_client.close()