I hereby claim:
- I am nicolaiarocci on github.
- I am nicolaiarocci (https://keybase.io/nicolaiarocci) on keybase.
- I have a public key whose fingerprint is 3E83 939B 0635 B124 805A EB07 3CE7 F44C 719B 8FC6
To claim this, I am signing this object:
import turtle | |
# alza la penna dal foglio | |
# (necessario perché per default è abbassata e traccerebbe una linea | |
# nel corso della setpos successiva) | |
turtle.up() | |
# imposta posizione iniziale della penna | |
# (0,0 è il centro del foglio) | |
turtle.setpos(-200, 0) |
from flask import Flask, request, jsonify | |
from mimerender_flask import mimerender | |
render_xml = lambda message: '<message>%s</message>' % message | |
render_json = jsonify | |
render_html = lambda message: '<html><body>%s</body></html>' % message | |
render_txt = lambda message: message | |
app = Flask(__name__) |
$ curl -H "Accept: application/html" localhost:5000/ | |
<html><body>Hello, World!</body></html> | |
$ curl -H "Accept: application/xml" localhost:5000/ | |
<message>Hello, World!</message> | |
$ curl -H "Accept: application/json" localhost:5000/ | |
{'message':'Hello, World!'} | |
$ curl -H "Accept: text/plain" localhost:5000/ |
render_xml = lambda message: '<message>%s</message>' % message | |
render_json = jsonify | |
render_html = lambda message: '<html><body>%s</body></html>' % message | |
render_txt = lambda message: message |
@mimerender( | |
default = 'html', | |
html = render_html, | |
xml = render_xml, | |
json = render_json, | |
txt = render_txt | |
) | |
def index(): | |
if request.method == 'GET': | |
return {'message': 'Hello, World!'} |
# -*- coding: utf-8 -*- | |
""" | |
Auth-BCrypt | |
~~~~~~~~~~~ | |
Securing an Eve-powered API with Basic Authentication (RFC2617). | |
This script assumes that user accounts are stored in a MongoDB collection | |
('accounts'), and that passwords are stored as BCrypt hashes. All API |
# -*- coding: utf-8 -*- | |
""" | |
Auth-SHA1/HMAC | |
~~~~~~~~~~~~~~ | |
Securing an Eve-powered API with Basic Authentication (RFC2617). | |
This script assumes that user accounts are stored in a MongoDB collection | |
('accounts'), and that passwords are stored as SHA1/HMAC hashes. All API |
I hereby claim:
To claim this, I am signing this object:
<?xml version="1.0" encoding="UTF-8"?> | |
<SetupPrereq> | |
<conditions> | |
<condition Type="16" Comparison="2" Path="[WindowsFolder]Microsoft.NET\Framework\v4.0.30319" FileName="mscorlib.dll" ReturnValue="4.0.30319.233"></condition> | |
<condition Type="1" Comparison="2" Path="HKEY_LOCAL_MACHINE\SOFTWARE\wow6432node\Microsoft\Updates\Microsoft .NET Framework 4 Extended\KB2468871\" FileName="" ReturnValue=""></condition> | |
<condition Type="1" Comparison="2" Path="HKEY_LOCAL_MACHINE\SOFTWARE\wow6432node\Microsoft\Updates\Microsoft .NET Framework 4 Client Profile\KB2468871\" FileName="" ReturnValue=""></condition> | |
</conditions> | |
<operatingsystemconditions> | |
<operatingsystemcondition MajorVersion="5" MinorVersion="2" PlatformId="2" CSDVersion="" Bits="4" ProductType="1" ServicePackMajorMin="3"></operatingsystemcondition> | |
<operatingsystemcondition MajorVersion="5" MinorVersion="2" PlatformId="2" CSDVersion="" Bits="4" ProductType="2|3" ServicePackMajorMin="2"></operatingsystemcondition> |
import copy | |
from cerberus import Validator | |
from cerberus import errors | |
from collections import Mapping, Sequence | |
class ObjectValidator(Validator): | |
def __init__(self, *args, **kwargs): |