I would appreciate it if someone could take a look at this issue:
I am using a Reolink IP camera to regularly query a still image via Python. The camera is connected to a TP Link switch via a LAN cable. The switch is connected to a Belkin Ethernet to USB-C adapter via a LAN cable. The adapter is connected to my Macbook Air M2 via USB-C.
I receive a camera image via the Reolink client software and I can also adjust the camera settings.
The IP address of the Ethernet interface (Belkin Adapter) is set to 192.168.0.204. The IP address of the camera is set to 192.168.0.201.
I can successfully access the camera's IP address via “ping”
Both the HTTP (80) and RTSP (554) ports are open and accessible.
I can query the RTSP stream via ffmpeg and VLC Media Player successfully.
However, when I make an HTTP request via Python, I get the error “Failed to establish a new connection: [Errno 65] No route to host.”
I have almost the same setup on my Windows PC, but I connect the switch directly to the PC's internal Ethernet interface via a LAN cable. The exact same Python script works without any problems here.
Does anyone have any idea what the problem could be? This is my example python code:
import requests
url = "http://192.168.0.201/snapshot.jpg"
auth = ("username", "password")
response = requests.get(url, auth=auth)
if response.status_code == 200:
with open("snapshot.jpg", "wb") as f:
f.write(response.content)
print("Snapshot saved!")
else:
print("Error:", response.status_code)