mirror of
https://codeberg.org/shm0rt/ddns-pdns-updater.git
synced 2025-07-30 13:58:06 +02:00
added python
This commit is contained in:
parent
768bcb7817
commit
39508da73b
3 changed files with 67 additions and 0 deletions
22
Connector.py
Normal file
22
Connector.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
import requests
|
||||
import Logger as logger
|
||||
|
||||
class Infomaniak:
|
||||
url: str=""
|
||||
hostname: str=""
|
||||
username: str=""
|
||||
password: str=""
|
||||
udpate_ip: str=""
|
||||
def __init__(self,url,hostname,username,password,update_ip=None,syslog_option:bool=False):
|
||||
self.url=url
|
||||
self.hostname=hostname
|
||||
self.username=username
|
||||
self.password=password
|
||||
self.update_ip=update_ip
|
||||
self.logger=logger.Logger(syslog=syslog_option)
|
||||
|
||||
def update(self) -> str:
|
||||
return requests.get(self._updatelink()).text
|
||||
|
||||
def _updatelink(self) -> str:
|
||||
return f"https://{self.username}:{self.password}@{self.url}?hostname={self.hostname}{f"&myip={self.update_ip}" if self.update_ip else""}"
|
Loading…
Add table
Add a link
Reference in a new issue