addressed review (urllib import and linting
This commit is contained in:
@@ -10,8 +10,7 @@ Daily REST Helpers
|
|||||||
Methods that wrap the Daily API to create rooms, check room URLs, and get meeting tokens.
|
Methods that wrap the Daily API to create rooms, check room URLs, and get meeting tokens.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import urllib.parse
|
from urllib.parse import urlparse
|
||||||
import urllib
|
|
||||||
import requests
|
import requests
|
||||||
from typing import Literal, Optional
|
from typing import Literal, Optional
|
||||||
from time import time
|
from time import time
|
||||||
@@ -32,8 +31,8 @@ class DailyRoomProperties(BaseModel):
|
|||||||
enable_emoji_reactions: bool = False
|
enable_emoji_reactions: bool = False
|
||||||
eject_at_room_exp: bool = True
|
eject_at_room_exp: bool = True
|
||||||
enable_dialout: Optional[bool] = None
|
enable_dialout: Optional[bool] = None
|
||||||
sip: DailyRoomSipParams = None
|
sip: DailyRoomSipParams = DailyRoomSipParams()
|
||||||
sip_uri: dict = None
|
sip_uri: dict = {}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sip_endpoint(self) -> str:
|
def sip_endpoint(self) -> str:
|
||||||
@@ -57,12 +56,12 @@ class DailyRoomObject(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class DailyRESTHelper:
|
class DailyRESTHelper:
|
||||||
def __init__(self, daily_api_key: str, daily_api_url: str = "api.daily.co/v1"):
|
def __init__(self, daily_api_key: str, daily_api_url: str = "https://api.daily.co/v1"):
|
||||||
self.daily_api_key = daily_api_key
|
self.daily_api_key = daily_api_key
|
||||||
self.daily_api_url = daily_api_url
|
self.daily_api_url = daily_api_url
|
||||||
|
|
||||||
def _get_name_from_url(self, room_url: str) -> str:
|
def _get_name_from_url(self, room_url: str) -> str:
|
||||||
return urllib.parse.urlparse(room_url).path[1:]
|
return urlparse(room_url).path[1:]
|
||||||
|
|
||||||
def create_room(self, params: DailyRoomParams) -> DailyRoomObject:
|
def create_room(self, params: DailyRoomParams) -> DailyRoomObject:
|
||||||
res = requests.post(
|
res = requests.post(
|
||||||
|
|||||||
Reference in New Issue
Block a user