Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dist/
MANIFEST
build/
.eggs/
.coverage/
.coverage
.vscode/
env/
venv/
Expand Down
5 changes: 2 additions & 3 deletions posthog/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import logging
import numbers
from datetime import datetime, timedelta
from uuid import uuid4
from uuid import UUID, uuid4

import requests
from dateutil.tz import tzutc
from six import string_types

Expand All @@ -21,7 +20,7 @@
import Queue as queue


ID_TYPES = (numbers.Number, string_types)
ID_TYPES = (numbers.Number, string_types, UUID)
__LONG_SCALE__ = float(0xFFFFFFFFFFFFFFF)


Expand Down
11 changes: 11 additions & 0 deletions posthog/test/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import time
import unittest
from datetime import date, datetime
from uuid import uuid4

import mock
import six
Expand Down Expand Up @@ -122,6 +123,16 @@ def test_basic_page(self):
self.assertEqual(msg["distinct_id"], "distinct_id")
self.assertEqual(msg["properties"]["$current_url"], "https://posthog.com/contact")

def test_basic_page_distinct_uuid(self):
client = self.client
distinct_id = uuid4()
success, msg = client.page(distinct_id, url="https://posthog.com/contact")
self.assertFalse(self.failed)
client.flush()
self.assertTrue(success)
self.assertEqual(msg["distinct_id"], str(distinct_id))
self.assertEqual(msg["properties"]["$current_url"], "https://posthog.com/contact")

def test_advanced_page(self):
client = self.client
success, msg = client.page(
Expand Down