123456789101112131415 |
- # -*- coding: utf-8 -*-
- #!/usr/bin/env python
- import threading
- from uuid import uuid4
- local = threading.local()
- def generate_request_id():
- return str(uuid4())
- def get_current_request_id():
- return getattr(local, 'request_id', generate_request_id())
|