Initial commit
This commit is contained in:
44
backend/ovh.py
Normal file
44
backend/ovh.py
Normal file
@@ -0,0 +1,44 @@
|
||||
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
|
||||
Reference in New Issue
Block a user