added python

This commit is contained in:
shm0rt 2025-07-15 13:18:40 +02:00
parent 768bcb7817
commit 39508da73b
3 changed files with 67 additions and 0 deletions

22
Connector.py Normal file
View 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""}"