Giter Club home page Giter Club logo

python-scripts's Introduction

Kia ora koutou,

Ko Ngāti Awa te iwi, ko Western taku ingoa. I am a Māori Infrastructure Engineer based in NZ. I aim to be kind, an enabling leader, and a lifelong-learner.

Skillset

  • Python, Java, C#, Kotlin
  • Docker, Kubernetes, Terraform
  • GitHub Actions, TeamCity, Octopus-Deploy
  • AWS, OpenStack, Catalyst Cloud
  • Unix, Bash, Powershell
  • JavaScript, HTML, CSS
  • SQL, NoSQL
  • Agile tools

Exposure to

  • Cisco IOS
  • React, Angular, Bulma CSS

Learning

  • Tailwind CSS
  • Vue.js

python-scripts's People

Contributors

wjkw1 avatar

Watchers

 avatar  avatar

python-scripts's Issues

Improve the API error handling in boiler plate & men & mice

Here is a quick snippet from online - https://www.secopshub.com/t/handling-api-errors-using-python-requests/589

        try:
            response = requests.post(_url, files={'file': some_file})
            response.raise_for_status()
        except requests.exceptions.HTTPError as errh:
            return "An Http Error occurred:" + repr(errh)
        except requests.exceptions.ConnectionError as errc:
            return "An Error Connecting to the API occurred:" + repr(errc)
        except requests.exceptions.Timeout as errt:
            return "A Timeout Error occurred:" + repr(errt)
        except requests.exceptions.RequestException as err:
            return "An Unknown Error occurred" + repr(err)

Improve the logger to be rolling file one for all scripts

The logging should be more effective on space

Example code:

    global path, uid, gid
    path = './logs'
    uid = pwd.getpwnam("example_user").pw_uid
    gid = grp.getgrnam("example_user").gr_gid
    if not os.path.exists(path):
        os.makedirs(path)
        os.chown(path, uid, gid)
    

    log_formatter = logging.Formatter('%(asctime)s sev=%(levelname)s file=%(filename)s module=%(name)s func=%(funcName)s %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
    log_file = './logs/meridian_ipam_poller.log'
    print(log_file)

    # Setup the logging as rotating handler
    my_handler = RotatingFileHandler(log_file, mode='a', maxBytes=5*1024*1024, backupCount=2, encoding=None, delay=0)
    my_handler.setFormatter(log_formatter)
    my_handler.setLevel(logging.INFO)

    # Setup the app logger
    global logger
    logger = logging.getLogger('root')
    logger.setLevel(logging.INFO)
    logger.addHandler(my_handler)

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.