posthog 6.7.11__tar.gz → 6.7.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. {posthog-6.7.11/posthog.egg-info → posthog-6.7.12}/PKG-INFO +1 -1
  2. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/langchain/callbacks.py +8 -2
  3. {posthog-6.7.11 → posthog-6.7.12}/posthog/integrations/django.py +29 -0
  4. {posthog-6.7.11 → posthog-6.7.12}/posthog/version.py +1 -1
  5. {posthog-6.7.11 → posthog-6.7.12/posthog.egg-info}/PKG-INFO +1 -1
  6. {posthog-6.7.11 → posthog-6.7.12}/LICENSE +0 -0
  7. {posthog-6.7.11 → posthog-6.7.12}/MANIFEST.in +0 -0
  8. {posthog-6.7.11 → posthog-6.7.12}/README.md +0 -0
  9. {posthog-6.7.11 → posthog-6.7.12}/posthog/__init__.py +0 -0
  10. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/__init__.py +0 -0
  11. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/anthropic/__init__.py +0 -0
  12. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/anthropic/anthropic.py +0 -0
  13. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/anthropic/anthropic_async.py +0 -0
  14. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/anthropic/anthropic_converter.py +0 -0
  15. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/anthropic/anthropic_providers.py +0 -0
  16. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/gemini/__init__.py +0 -0
  17. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/gemini/gemini.py +0 -0
  18. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/gemini/gemini_converter.py +0 -0
  19. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/langchain/__init__.py +0 -0
  20. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/openai/__init__.py +0 -0
  21. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/openai/openai.py +0 -0
  22. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/openai/openai_async.py +0 -0
  23. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/openai/openai_converter.py +0 -0
  24. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/openai/openai_providers.py +0 -0
  25. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/sanitization.py +0 -0
  26. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/types.py +0 -0
  27. {posthog-6.7.11 → posthog-6.7.12}/posthog/ai/utils.py +0 -0
  28. {posthog-6.7.11 → posthog-6.7.12}/posthog/args.py +0 -0
  29. {posthog-6.7.11 → posthog-6.7.12}/posthog/client.py +0 -0
  30. {posthog-6.7.11 → posthog-6.7.12}/posthog/consumer.py +0 -0
  31. {posthog-6.7.11 → posthog-6.7.12}/posthog/contexts.py +0 -0
  32. {posthog-6.7.11 → posthog-6.7.12}/posthog/exception_capture.py +0 -0
  33. {posthog-6.7.11 → posthog-6.7.12}/posthog/exception_utils.py +0 -0
  34. {posthog-6.7.11 → posthog-6.7.12}/posthog/feature_flags.py +0 -0
  35. {posthog-6.7.11 → posthog-6.7.12}/posthog/integrations/__init__.py +0 -0
  36. {posthog-6.7.11 → posthog-6.7.12}/posthog/poller.py +0 -0
  37. {posthog-6.7.11 → posthog-6.7.12}/posthog/py.typed +0 -0
  38. {posthog-6.7.11 → posthog-6.7.12}/posthog/request.py +0 -0
  39. {posthog-6.7.11 → posthog-6.7.12}/posthog/test/__init__.py +0 -0
  40. {posthog-6.7.11 → posthog-6.7.12}/posthog/test/test_before_send.py +0 -0
  41. {posthog-6.7.11 → posthog-6.7.12}/posthog/test/test_client.py +0 -0
  42. {posthog-6.7.11 → posthog-6.7.12}/posthog/test/test_consumer.py +0 -0
  43. {posthog-6.7.11 → posthog-6.7.12}/posthog/test/test_contexts.py +0 -0
  44. {posthog-6.7.11 → posthog-6.7.12}/posthog/test/test_exception_capture.py +0 -0
  45. {posthog-6.7.11 → posthog-6.7.12}/posthog/test/test_feature_flag.py +0 -0
  46. {posthog-6.7.11 → posthog-6.7.12}/posthog/test/test_feature_flag_result.py +0 -0
  47. {posthog-6.7.11 → posthog-6.7.12}/posthog/test/test_feature_flags.py +0 -0
  48. {posthog-6.7.11 → posthog-6.7.12}/posthog/test/test_module.py +0 -0
  49. {posthog-6.7.11 → posthog-6.7.12}/posthog/test/test_request.py +0 -0
  50. {posthog-6.7.11 → posthog-6.7.12}/posthog/test/test_size_limited_dict.py +0 -0
  51. {posthog-6.7.11 → posthog-6.7.12}/posthog/test/test_types.py +0 -0
  52. {posthog-6.7.11 → posthog-6.7.12}/posthog/test/test_utils.py +0 -0
  53. {posthog-6.7.11 → posthog-6.7.12}/posthog/types.py +0 -0
  54. {posthog-6.7.11 → posthog-6.7.12}/posthog/utils.py +0 -0
  55. {posthog-6.7.11 → posthog-6.7.12}/posthog.egg-info/SOURCES.txt +0 -0
  56. {posthog-6.7.11 → posthog-6.7.12}/posthog.egg-info/dependency_links.txt +0 -0
  57. {posthog-6.7.11 → posthog-6.7.12}/posthog.egg-info/requires.txt +0 -0
  58. {posthog-6.7.11 → posthog-6.7.12}/posthog.egg-info/top_level.txt +0 -0
  59. {posthog-6.7.11 → posthog-6.7.12}/pyproject.toml +0 -0
  60. {posthog-6.7.11 → posthog-6.7.12}/setup.cfg +0 -0
  61. {posthog-6.7.11 → posthog-6.7.12}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: posthog
3
- Version: 6.7.11
3
+ Version: 6.7.12
4
4
  Summary: Integrate PostHog into any python application.
5
5
  Home-page: https://github.com/posthog/posthog-python
6
6
  Author: Posthog
@@ -20,8 +20,14 @@ from typing import (
20
20
  )
21
21
  from uuid import UUID
22
22
 
23
- from langchain.callbacks.base import BaseCallbackHandler
24
- from langchain.schema.agent import AgentAction, AgentFinish
23
+ try:
24
+ # LangChain 1.0+ and modern 0.x with langchain-core
25
+ from langchain_core.callbacks.base import BaseCallbackHandler
26
+ from langchain_core.agents import AgentAction, AgentFinish
27
+ except (ImportError, ModuleNotFoundError):
28
+ # Fallback for older LangChain versions
29
+ from langchain.callbacks.base import BaseCallbackHandler
30
+ from langchain.schema.agent import AgentAction, AgentFinish
25
31
  from langchain_core.documents import Document
26
32
  from langchain_core.messages import (
27
33
  AIMessage,
@@ -220,3 +220,32 @@ class PosthogContextMiddleware:
220
220
  contexts.tag(k, v)
221
221
 
222
222
  return await self.get_response(request)
223
+
224
+ def process_exception(self, request, exception):
225
+ # type: (HttpRequest, Exception) -> None
226
+ """
227
+ Process exceptions from views and downstream middleware.
228
+
229
+ Django calls this WHILE still inside the context created by __call__,
230
+ so request tags have already been extracted and set. This method just
231
+ needs to capture the exception directly.
232
+
233
+ Django converts view exceptions into responses before they propagate through
234
+ the middleware stack, so the context manager in __call__/__acall__ never sees them.
235
+
236
+ Note: Django's process_exception is always synchronous, even for async views.
237
+ """
238
+ if self.request_filter and not self.request_filter(request):
239
+ return
240
+
241
+ if not self.capture_exceptions:
242
+ return
243
+
244
+ # Context and tags already set by __call__ or __acall__
245
+ # Just capture the exception
246
+ if self.client:
247
+ self.client.capture_exception(exception)
248
+ else:
249
+ from posthog import capture_exception
250
+
251
+ capture_exception(exception)
@@ -1,4 +1,4 @@
1
- VERSION = "6.7.11"
1
+ VERSION = "6.7.12"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  print(VERSION, end="") # noqa: T201
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: posthog
3
- Version: 6.7.11
3
+ Version: 6.7.12
4
4
  Summary: Integrate PostHog into any python application.
5
5
  Home-page: https://github.com/posthog/posthog-python
6
6
  Author: Posthog
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes