Skip to content

Instantly share code, notes, and snippets.

View yugyesh's full-sized avatar
🎯
Focusing

Yugesh kc yugyesh

🎯
Focusing
View GitHub Profile
@hanxue
hanxue / api.py
Last active August 19, 2021 07:26
Flask-restful with POST and PATCH methods
from flask import Flask
from flask_restful import Resource, Api, reqparse
app = Flask(__name__)
api = Api(app)
parser = reqparse.RequestParser()
class PostAndPatch(Resource):
def post(self):
@theorm
theorm / flask_objectid_converter.py
Created January 8, 2013 11:19
MongoDB ObjectId converter for Flask framework.
-*- coding: utf-8 -*-
from werkzeug.routing import BaseConverter
from werkzeug.exceptions import BadRequest
import bson
class ObjectIdConverter(BaseConverter):
'''Converts string to :class:`~bson.objectid.ObjectId` and
vise versa::