|
You are here |
florimond.dev | ||
| | | | |
bruceeckel.com
|
|
| | | | | [AI summary] Bruce Eckel demonstrates six Python tricks for writing cleaner, more efficient code, including converting scripts to Windows executables, context managers, argument parsing, and configuration handling. | |
| | | | |
0x00.cl
|
|
| | | | | Tomas Gutierrez L. personal website (0x00) | |
| | | | |
janakiev.com
|
|
| | | | | When writing programs, there is often a large set of configuration and credentials that should not be hard-coded in the program. This also makes the customization of the program much easier and more generally applicable. There are various ways to handle configuration and credentials and you will see here a few of the popular and common ways to do that with Python. | |
| | | | |
memo.mx
|
|
| | | Usage: pip install pynetbox ansible ansible all -i hosts/env -m setup --tree /tmp/facts/env #!/opt/netbox/bin/python import argparse import json import os import sys import pynetbox import yaml import urllib3 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) if sys.version_info < (3, 6): print("Python 3.6 is required") sys.exit(2) def to_json(in_dict): return json.dumps(in_dict, sort_keys=True, indent=4) def load_configuration(path="/etc/ansible/netbox.yml"): """ Load netbox configurati... | ||