You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I stumbled accross your api and I loved it. It basically does everything I want to do, BUT I have a Speedport 3 in place. Whenever I try to run your code it raises a connection error as seen below:
Traceback (most recent call last):
File "/Users/USERNAME/Library/CloudStorage/OneDrive-TUI/Skripte/Python Skripte/network.py", line 23, in <module>
devices = asyncio.run(Speedport().devices)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/USERNAME/.pyenv/versions/3.11.6/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/Users/USERNAME/.pyenv/versions/3.11.6/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/USERNAME/.pyenv/versions/3.11.6/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/USERNAME/.pyenv/versions/3.11.6/lib/python3.11/site-packages/speedport/speedport.py", line 81, in devices
data = await self.api.get_devices()
^^^^^^^^
File "/Users/USERNAME/.pyenv/versions/3.11.6/lib/python3.11/site-packages/speedport/speedport.py", line 77, in api
raise ConnectionError()
Here is why I find this really interesting. When I try to connect to the router via script a (synchronously) the script says
Login successful!
/Users/USERNAME/Library/CloudStorage/OneDrive-TUI/Skripte/Python Skripte/network.py:16: RuntimeWarning: coroutine 'Speedport.login' was never awaited
in script b (asynchronously) I receive the already posted connection error. Is there more to it that I don't see or is it "just" because of the speedport 3? I have to admit network stuff (specifically web and javascript) are not my strongsuit.
script a
from speedport import Speedport
def login_to_router(url, password):
speedport = Speedport(url)
# Login to the router
login_status = speedport.login(password)
if login_status:
print("Login successful!")
else:
print("Login failed!")
url = 'http://192.168.2.1'
password = 'PASSWORD'
login_to_router(url, password)
script b
from speedport import Speedport
import asyncio
async def login_to_router(url, password):
try:
speedport = Speedport(url)
# Try to login to the router
login_status = await speedport.login(password)
if login_status:
print("Login successful!")
else:
print("Login failed!")
except Exception as e:
print(f"Failed to connect to the router. Error: {e}")
url = 'http://192.168.2.1' # replace with your router's URL
password = 'PASSWORD' # replace with your password
asyncio.run(login_to_router(url, password))
The text was updated successfully, but these errors were encountered:
Hey Andre,
I stumbled accross your api and I loved it. It basically does everything I want to do, BUT I have a Speedport 3 in place. Whenever I try to run your code it raises a connection error as seen below:
Here is why I find this really interesting. When I try to connect to the router via script a (synchronously) the script says
in script b (asynchronously) I receive the already posted connection error. Is there more to it that I don't see or is it "just" because of the speedport 3? I have to admit network stuff (specifically web and javascript) are not my strongsuit.
script a
script b
The text was updated successfully, but these errors were encountered: