Skip to content

Commit

Permalink
Add example, rename package
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre0512 committed Dec 5, 2022
1 parent a0cb1e0 commit b92ba7c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 12 deletions.
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,56 @@
**This python package is unofficial and is not related in any way to Telekom. It was developed by reversed engineered http requests and can stop working at anytime!**

# Speedport-API
## Speedport-API
Control Telekom Speedport routers with Python!
### Supported Devices
* Speedport Smart 4
### Installation
```commandline
pip install speedport-api
```
## Commandline tool

### Supported Devices
* Speedport Smart 4

### Commandline tool
With this shipped commandline tool can a speedport in your network be controlled.

#### Turn wifi off
```commandline
$ speedport wifi off
Turn off wifi...
```

#### Turn guest wifi on
```commandline
$ speedport guest-wifi on
Turn on guest wifi...
```

#### Reconnect for new ip address
```commandline
$ speedport reconnect
123.45.67.89 / 5403:f3:35aa:12f:7287:41cf:fb1c:3c83
Reconnect with internet provider...
123.45.67.12 / 5403:f3:35fe:12f:7287:41cf:fb1c:3c83
```

#### Enable wps connect
```commandline
$ speedport wps
Enable wps connect...
wpc connect enabled for 113s...
```
## Library

### Library

#### Reconnect example
```python
import asyncio
from speedport import Speedport

async def reconnect():
async with Speedport("192.168.178.1") as speedport:
await speedport.login("password123")
await speedport.reconnect()

asyncio.run(reconnect())
```
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
from pathlib import Path

from setuptools import setup

Expand All @@ -11,7 +10,7 @@

setup(
name="speedport-api",
version="0.2.1",
version="0.3.0",
author="Andre Basche",
description="Control Telekom Speedport routers with Python",
long_description=long_description,
Expand All @@ -21,13 +20,13 @@
platforms="any",
py_modules=["jeelink-python"],
package_dir={"": "src"},
packages=["speedport_api"],
packages=["speedport"],
include_package_data=True,
python_requires=">=3.8",
install_requires=requirements,
entry_points={
'console_scripts': [
'speedport = speedport_api.__main__:main',
'speedport = speedport.__main__:start',
]
}
)
File renamed without changes.
8 changes: 6 additions & 2 deletions src/speedport_api/__main__.py → src/speedport/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import time
from getpass import getpass

from .speedport import Speedport
from speedport import Speedport

_LOGGER = logging.getLogger("speedport")

Expand Down Expand Up @@ -91,8 +91,12 @@ async def wps_enable(args, speedport):
print(f"wps connect enabled for {120 - int(time.time() - event)}s...", end="\r", flush=True)


if __name__ == '__main__':
def start():
try:
asyncio.run(main())
except KeyboardInterrupt:
print("Aborted.")


if __name__ == '__main__':
start()
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class WlanDevice(dict):


class Speedport:
def __init__(self, host="speedport_api.ip"):
def __init__(self, host="speedport.ip"):
# Is this the default key for everyone or should we parse it?
self._default_key = "cdc0cac1280b516e674f0057e4929bca84447cca8425007e33a88a5cf598a190"
self._login_key = ""
Expand Down

0 comments on commit b92ba7c

Please sign in to comment.