Skip to main content
  1. Tags/

Python

2025


Cleaning Up Python Environment

·893 words·5 mins
Recently I updated my Python development environments to use Python UV for managing Python versions and tools on the system. In this post I take you on the journey that I went on to replace pyenv and Pipx.

2023


Nautobot: Get IP Addresses From Nautobot

·1979 words·10 mins

One of Nautobot’s primary functions is to serve as an IPAM solution. Within that realm, the application needs to provide a method to get at IP address data for a device, quickly and easily. In this post I will review three prominent methods to get an IP address from Nautobot. It will demonstrate getting the address via:

  • Nautobot REST API
    • curl
    • Python Requests
    • GoLang HTTP
    • pynautobot
    • Ansible Lookup
  • Nautobot GraphQL API
    • curl
    • Python Requests
    • GoLang HTTP
    • pynautobot
    • Ansible Lookup

Each method I will demonstrate how to get the IP address for Loopback0 on the device bre01-edge-01 within the demo instance of Nautobot. This device has 62 interfaces, so being able to filter down to which interface IP address we are looking for makes sense.

2022


GraphQL - Aliasing

·1045 words·5 mins

One of the features that I find myself using periodically that I think is underrated as far as using GraphQL is its ability to alias return keys in the response. This can be extremely helpful for developers writing applications, as it allows them to have the API response with the keys they are looking for. I have found this feature particularly useful when working on applications like Meraki and Nautobot together. In Nautobot a place is typically defined as the key site. In the Meraki world this is commonly set up as a network. Without GraphQL’s alias feature, the developer would need to translate this data over.

Python Pseudo Code

·519 words·3 mins

One of my favorite things to do as I get started with writing a piece of automation or code, is to lay out the design with pseudo code in the form of comments. I will do this with both Python and Ansible automations, and is a great way to get started on writing your automation or code. What pseudo code does for you is to layout the process at which you wish to accomplish a particular goal. And from there, you write the code that corresponds to the plain English wording of what is being done. By starting with pseudo code, you are starting with the process first. Then working on getting to the details of the code as you go.