In my case it worked with below code:
traceparent = context.trace_context.trace_parent operation_id = f"{traceparent}".split('-')[1]