This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from string import Template | |
class MyOtherTemplate(Template): | |
delimiter = "#" | |
data = dict(id = 1, name = "Ricardo") | |
t = MyOtherTemplate("My name is #name and I have the id: #id") | |
print(t.substitute(data)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:16.10 | |
MAINTAINER Ricardo Baltazar Chaves <ricardobchaves6@gmail.com> | |
RUN apt-get update | |
RUN apt-get -y upgrade | |
RUN apt-get install -y python3.6 python-pip | |
#https://hub.docker.com/r/ricardobchaves6/myubuntu16-10/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expected_result = { | |
"name": "Ricardo", | |
"image": "https://www.ricardobaltazar.com/static/principal/images/profilepic-new.jpg", | |
"age": 37, | |
"birth_date": "1981-06-21T12:42:31+00:32" | |
} | |
result = client.get("/user/info") | |
self.assertDictEqual(result.json, expected_result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jsonschema import validate | |
from jsonschema import FormatChecker | |
data = { | |
"name": "Ricardo", | |
"image": "https://www.ricardobaltazar.com/static/principal/images/profilepic-new.jpg", | |
"age": 37, | |
"birth_date": "1981-06-21T12:42:31+00:32" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "object", | |
"properties": { | |
"name": { | |
"type": "string" | |
} | |
}, | |
"required": [ "name" ] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask import jsonify | |
from time import sleep | |
from datetime import datetime | |
app = Flask(__name__) | |
@app.route("/") | |
def hello(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.5" | |
services: | |
nginx1: | |
image: nginx:1.13.3 | |
volumes: | |
- ./nginx/local.nginx.conf:/etc/nginx/nginx.conf | |
depends_on: | |
- api | |
links: | |
- api:api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dist: trusty | |
sudo: false | |
cache: | |
directories: | |
- "$HOME/google-cloud-sdk/" | |
services: | |
- docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
docker build -t gcr.io/${PROJECT_DEV}/${IMAGE_NAME}:$TRAVIS_COMMIT . | |
echo $GCLOUD_SERVICE_KEY_DEV | base64 --decode -i > ${HOME}/gcloud-service-key.json | |
gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json | |
gcloud --quiet config set project $PROJECT_DEV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route("/login") | |
def login(): | |
auth_state = str(uuid.uuid4()) | |
flask.session["state"] = auth_state | |
authorization_url = TEMPLATE_AUTHZ_URL.format( | |
config.TENANT, config.CLIENT_ID, REDIRECT_URI, auth_state, config.RESOURCE | |
) | |
resp = flask.Response(status=307) | |
resp.headers["location"] = authorization_url | |
return resp |
OlderNewer