Skip to content

Commit

Permalink
Merge pull request #1086 from pipecat-ai/mb/fix-expiry-time-type-mism…
Browse files Browse the repository at this point in the history
…atch
  • Loading branch information
markbackman authored Jan 24, 2025
2 parents 96b90ab + abf0d0d commit b881dd5
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/pipecat/transports/services/helpers/daily_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,9 @@ async def get_token(
room_url: Daily room URL
expiry_time: Token validity duration in seconds (default: 1 hour)
owner: Whether token has owner privileges
params: Parameters for creating a Daily meeting token
params: Optional additional token properties. Note that room_name,
exp, and is_owner will be set based on the other function
parameters regardless of values in params.
Returns:
str: Meeting token
Expand All @@ -309,25 +311,21 @@ async def get_token(
"No Daily room specified. You must specify a Daily room in order a token to be generated."
)

expiration: float = time.time() + expiry_time
expiration: int = int(time.time() + expiry_time)

room_name = self.get_name_from_url(room_url)

headers = {"Authorization": f"Bearer {self.daily_api_key}"}

if params is None:
params = DailyMeetingTokenParams(
**{
"properties": {
"room_name": room_name,
"is_owner": owner,
"exp": int(expiration),
}
}
properties=DailyMeetingTokenProperties(
room_name=room_name, is_owner=owner, exp=expiration
)
)
else:
params.properties.room_name = room_name
params.properties.exp = int(expiration)
params.properties.exp = expiration
params.properties.is_owner = owner

json = params.model_dump(exclude_none=True)
Expand Down

0 comments on commit b881dd5

Please sign in to comment.