Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant_api/_async/asyncclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ async def async_trigger_service(
) -> List[State]:
"""Tells Home Assistant to trigger a service, returns stats changed while being called"""
data = await self.async_request(
join("services", domain + "/" + service),
f"services/{domain}/{service}",
method="POST",
json=service_data,
)
Expand Down
8 changes: 4 additions & 4 deletions homeassistant_api/rawapi.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Module for parent RawWrapper class"""

import os
import re
from datetime import datetime
from typing import Dict, Optional, Tuple, Union
from urllib.parse import urljoin as join

from .const import DATE_FMT
from .models import Entity
Expand Down Expand Up @@ -42,7 +42,7 @@ def __init__(

def endpoint(self, path: str) -> str:
"""Joins the api base url with a local path to an absolute url"""
return os.path.join(self.api_url, path)
return join(self.api_url, path)

@property
def _headers(self) -> Dict[str, str]:
Expand Down Expand Up @@ -122,7 +122,7 @@ def prepare_get_entity_histories_params(
if start_timestamp is not None:
if isinstance(start_timestamp, datetime):
formatted_timestamp = start_timestamp.strftime(DATE_FMT)
url = os.path.join("history/period", formatted_timestamp)
url = join("history/period", formatted_timestamp)
else:
raise TypeError(f"timestamp needs to be of type {datetime!r}")
else:
Expand All @@ -148,7 +148,7 @@ def prepare_get_logbook_entry_params(
if start_timestamp is not None:
if isinstance(start_timestamp, datetime):
formatted_timestamp = start_timestamp.strftime(DATE_FMT)
url = os.path.join("logbook", formatted_timestamp)
url = join("logbook", formatted_timestamp)
else:
url = "logbook"
return params, url