Contains boilerplate Makefile for Python development work.
$ make
# Output...| def getSignedJWT(self, privateKey, clientid, aud, algorithm = 'RS256'): | |
| # Algo : RS256, RS384, RS512, ES256, ES384, ES512 | |
| now = int(time.time()) | |
| token = {'iss': clientid, | |
| 'sub': clientid, | |
| 'aud': aud, | |
| 'iat': now , | |
| 'exp': now + 3600 } | |
| encoded = jwt.encode(token, privateKey, algorithm) | |
| return encoded |
| # WIP | |
| name: deploy-heroku | |
| # Trigger only on v#.#.#-Release tag | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*-release" |
| #------------------------------------------------------------------------------------------------------------- | |
| # Copyright (c) Microsoft Corporation. All rights reserved. | |
| # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. | |
| #------------------------------------------------------------------------------------------------------------- | |
| # Update the VARIANT arg in devcontainer.json to pick a Python version: 3, 3.8, 3.7, 3.6 | |
| # To fully customize the contents of this image, use the following Dockerfile instead: | |
| # https://github.com/microsoft/vscode-dev-containers/tree/v0.112.0/containers/python-3/.devcontainer/base.Dockerfile | |
| ARG VARIANT="3" | |
| FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} |
| # //BUG: There is bug in the '-e'. Maybe have to two sed calls to the same log file? | |
| function scrub_log() { | |
| sed -i -e 's/^Authorization: SSWS.*/Authorization: SSWS not_real_base64_token/g' -e 's/^Authorization: Bearer.*/Authorization: Bearer not_real_base64_token/g' @{1} | |
| } |
| from datetime import datetime | |
| from sqlalchemy import Column, Integer, DateTime, ForeignKey | |
| from sqlalchemy.orm import relationship | |
| from sqlalchemy.ext.declarative import declared_attr | |
| from flask_security import current_user | |
| class AuditMixin(object): | |
| created_at = Column(DateTime, default=datetime.now) | |
| updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now) |