Skip to content

Commit 6f0cb89

Browse files
authored
Merge pull request #376 from fersingb/add_uuid
Add a random ID
2 parents a7c7bb8 + 0d2eeca commit 6f0cb89

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pyhilo/const.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import logging
22
import platform
3+
import uuid
34
from typing import Final
45

56
import aiohttp
67

8+
# THe instance ID is random and unique to a specific instance/run.
9+
# Helps identifying multiple instances behind the same public IP, can be useful to the Hilo/HQ devs for debugging purposes
10+
INSTANCE_ID: Final = str(uuid.uuid4())[24:]
711
LOG: Final = logging.getLogger(__package__)
812
DEFAULT_STATE_FILE: Final = "hilo_state.yaml"
913
REQUEST_RETRY: Final = 9
@@ -46,7 +50,7 @@
4650

4751

4852
# Request constants
49-
DEFAULT_USER_AGENT: Final = f"PyHilo/{PYHILO_VERSION} aiohttp/{aiohttp.__version__} Python/{platform.python_version()}"
53+
DEFAULT_USER_AGENT: Final = f"PyHilo/{PYHILO_VERSION}-{INSTANCE_ID} aiohttp/{aiohttp.__version__} Python/{platform.python_version()}"
5054

5155

5256
# NOTE(dvd): Not sure how to get new ones so I'm using the ones from my emulator

0 commit comments

Comments
 (0)