44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
import configparser
|
|
import requests
|
|
|
|
|
|
def reverse_ip_to_standard(reverse_ip):
|
|
parts = reverse_ip.split(".")
|
|
parts = parts[:4]
|
|
standard_ip = ".".join(reversed(parts))
|
|
|
|
return standard_ip
|
|
|
|
|
|
class OvhBackend:
|
|
def __init__(self, config_file='config.ini'):
|
|
self.config_file = config_file
|
|
self.username = None
|
|
self.password = None
|
|
|
|
self.load_credentials()
|
|
|
|
def load_credentials(self):
|
|
config = configparser.ConfigParser()
|
|
config.read(self.config_file)
|
|
|
|
if "OVH" not in config:
|
|
raise ValueError("OVH section not found in config.ini")
|
|
|
|
self.username = config["OVH"].get("username")
|
|
self.password = config["OVH"].get("password")
|
|
|
|
if not self.username or not self.password:
|
|
raise ValueError("OVH username or password not provided in config.ini")
|
|
|
|
def update_record(self, reverse_ip, record):
|
|
# Do update record stuff here
|
|
pass
|
|
|
|
def create_record(self, reverse_ip, record):
|
|
# Do create record stuff here
|
|
pass
|
|
|
|
def delete_record(self, reverse_ip):
|
|
# Do delete record stuff here
|
|
pass |