Git Product home page Git Product logo

hdns_cli's People

Contributors

lanbugs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hdns_cli's Issues

update_record resets ttl to zero

update_record resets the ttl of my A record to 0.
I found no way to edit the ttl after the update via hdns cli to my needs.

Is it a missing feature or am I overlooking a command I could use after the update to achieve editing the ttl?
Thank you in advance and for your great work!

show_zones > 100 Entries

Hi,

the Hetzner DNS Api returns only the first 100 entries.
I'm managing > 500 DNS Entries at the moment.

i did some changes to support up to 1000 entries.
Maybe you can adopt the idea

--
def show_zones(self):
""" Show all zones eg. hdns show_zones """
pageNum = 1

    result_header = ['ID', 'Zone', 'Secondary?', 'NS']
    results = []

    while pageNum <= 10	:
        try:
            response = requests.get(
                url=f"https://{self.SYSTEM}/api/v1/zones?page={pageNum}",
                headers={"Auth-API-Token": self.API_TOKEN}
            )
    
            status_code = response.status_code
            content = json.loads(response.content)

            for zone in content['zones']:
                results.append(
                    [
                        zone['id'],
                        zone['name'],
                        zone['is_secondary_dns'],
                        ", ".join(zone['ns'])um = pageNum + 1

        except requests.exceptions.RequestException as e:
            logger.exception(e)

hdns_cli.py.txt

    print(f"*** Zones @ {self.SYSTEM} " + "*"*80)
    print(tabulate.tabulate(results, result_header))

--

and:

--
def _get_zone_id(self, zone_name):
""" PRIVATE: Get the zone id to work with names in records add, mod, remove """
try:
pageNum = 1
while pageNum <= 10 :
response = requests.get(
url=f"https://{self.SYSTEM}/api/v1/zones?page={pageNum}",
headers={"Auth-API-Token": self.API_TOKEN}
)

            status_code = response.status_code
            content = json.loads(response.content)

            if status_code == 200:
                for zone in content['zones']:
                    if zone_name == zone['name']:
                        return zone['id']

            pageNum = pageNum + 1

        return False

    except requests.exceptions.RequestException as e:
        logger.exception(e)

--

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.