Skip to content

Commit 1b57a96

Browse files
authored
automatically retry connection errors (#190)
* automatically retry connection errors from the docs for max_retries: this applies only to failed DNS lookups, socket connections and connection timeouts * run tests on multiple python versions * update freezegun
1 parent 38683e8 commit 1b57a96

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,21 @@ jobs:
4747
mypy --no-site-packages --config-file mypy.ini . | mypy-baseline filter
4848
4949
tests:
50-
name: Python tests
50+
name: Python ${{ matrix.python-version }} tests
5151
runs-on: ubuntu-latest
52+
strategy:
53+
matrix:
54+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
5255

5356
steps:
5457
- uses: actions/checkout@v2
5558
with:
5659
fetch-depth: 1
5760

58-
- name: Set up Python 3.9
61+
- name: Set up Python ${{ matrix.python-version }}
5962
uses: actions/setup-python@v2
6063
with:
61-
python-version: 3.9
64+
python-version: ${{ matrix.python-version }}
6265

6366
- name: Install requirements.txt dependencies with pip
6467
run: |

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.13.0 - 2025-02-12
2+
3+
1. Automatically retry connection errors
4+
15
## 3.12.1 - 2025-02-11
26

37
1. Fix mypy support for 3.12.0

posthog/request.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
from posthog.utils import remove_trailing_slash
1212
from posthog.version import VERSION
1313

14+
adapter = requests.adapters.HTTPAdapter(max_retries=2)
1415
_session = requests.sessions.Session()
16+
_session.mount("https://", adapter)
1517

1618
US_INGESTION_ENDPOINT = "https://us.i.posthog.com"
1719
EU_INGESTION_ENDPOINT = "https://eu.i.posthog.com"

posthog/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = "3.12.1"
1+
VERSION = "3.13.0"
22

33
if __name__ == "__main__":
44
print(VERSION, end="") # noqa: T201

setup.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
],
4343
"test": [
4444
"mock>=2.0.0",
45-
"freezegun==0.3.15",
45+
"freezegun==1.5.1",
4646
"pylint",
4747
"flake8",
4848
"coverage",
@@ -92,19 +92,10 @@
9292
"License :: OSI Approved :: MIT License",
9393
"Operating System :: OS Independent",
9494
"Programming Language :: Python",
95-
"Programming Language :: Python :: 2",
96-
"Programming Language :: Python :: 2.6",
97-
"Programming Language :: Python :: 2.7",
98-
"Programming Language :: Python :: 3",
99-
"Programming Language :: Python :: 3.2",
100-
"Programming Language :: Python :: 3.3",
101-
"Programming Language :: Python :: 3.4",
102-
"Programming Language :: Python :: 3.5",
103-
"Programming Language :: Python :: 3.6",
104-
"Programming Language :: Python :: 3.7",
105-
"Programming Language :: Python :: 3.8",
10695
"Programming Language :: Python :: 3.9",
10796
"Programming Language :: Python :: 3.10",
10897
"Programming Language :: Python :: 3.11",
98+
"Programming Language :: Python :: 3.12",
99+
"Programming Language :: Python :: 3.13",
109100
],
110101
)

0 commit comments

Comments
 (0)