Skip to content

Commit

Permalink
fix apitally config
Browse files Browse the repository at this point in the history
  • Loading branch information
Masterain98 committed Feb 27, 2025
1 parent d8a8b8f commit ebbb5b7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,13 @@ def get_commit_hash_str():

def identify_user(request: Request) -> None:
# Extract headers
device_id = request.headers.get("User-Agent", "unknown-device")
reqable_id = request.headers.get("Reqable-Id", None)
user_agent = request.headers.get("User-Agent", "unknown-group")
user_agent = request.headers.get("User-Agent", "unknown-UA")

# Assign to Apitally consumer
request.state.apitally_consumer = ApitallyConsumer(
identifier=device_id if reqable_id is None else reqable_id,
name=device_id,
group=user_agent if reqable_id is None else "Reqable",
identifier="Reqable" if reqable_id else user_agent,
group="Reqable" if reqable_id else "Snap Hutao"
)


Expand Down

0 comments on commit ebbb5b7

Please sign in to comment.