Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoded password special characters in stream url #163

Merged
Merged
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
7 changes: 5 additions & 2 deletions custom_components/hikvision_next/isapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import json
import logging
from typing import Any, Optional
from urllib.parse import urlparse
from urllib.parse import quote, urlparse

from hikvisionapi import AsyncClient
from httpx import HTTPStatusError, TimeoutException
Expand Down Expand Up @@ -854,7 +854,10 @@ async def get_camera_image(

def get_stream_source(self, stream: CameraStreamInfo) -> str:
"""Get stream source."""
return f"rtsp://{self.isapi.login}:{self.isapi.password}@{self.device_info.ip_address}:{self.device_info.rtsp_port}/Streaming/channels/{stream.id}"
u = quote(self.isapi.login, safe="")
p = quote(self.isapi.password, safe="")
url = f"{self.device_info.ip_address}:{self.device_info.rtsp_port}/Streaming/channels/{stream.id}"
return f"rtsp://{u}:{p}@{url}"


def str_to_bool(value: str) -> bool:
Expand Down
Loading