Skip to content

Instantly share code, notes, and snippets.

@tarekziade
tarekziade / api.py
Last active August 1, 2018 16:57
connexion as an extension
import pathlib
from connexion.api import Api, Resolver
import werkzeug.exceptions
def swagger_blueprint(specification, specification_dir=None, validate_responses=False,
strict_validation=False, resolver_error=None,
base_path='', debug=False):
resolver = Resolver()
swagger_json = False
@cuibonobo
cuibonobo / bluetooth_kivy.py
Last active October 10, 2023 12:19 — forked from tito/bluetooth.py
Bluetooth example with Kivy. A more fleshed-out example here: https://github.com/tito/android-demo. A more modern way of doing it: https://github.com/kivy/plyer. And this guy used Kivy to connect to an Arduino: https://github.com/brean/arduino-kivy-bluetooth. Native Kivy code (?): https://groups.google.com/d/msg/kivy-users/n_cMbFzf_1A/5edKgQgycx0J
# Same as before, with a kivy-based UI
'''
Bluetooth/Pyjnius example
=========================
This was used to send some bytes to an arduino via bluetooth.
The app must have BLUETOOTH and BLUETOOTH_ADMIN permissions (well, i didn't
tested without BLUETOOTH_ADMIN, maybe it works.)
@metatoaster
metatoaster / app.py
Created September 19, 2013 15:58
Flask Principal Permission override demo
from flask import Flask, request, abort, g, current_app
from flask.ext.principal import Principal
from flask.ext.principal import Identity, identity_changed, identity_loaded
from flask.ext.principal import Permission, Need, RoleNeed, ItemNeed
app = Flask(__name__)
app.config['SECRET_KEY'] = 'test_secret_key'
app.config['TESTING'] = True