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
In [1]: from requests import get, post, put, delete | |
In [2]: get("http://127.0.0.1:5000/api") | |
In [3]: data = {"name": "Example Name", "registration": "123433199", "department": "cse"} | |
In [4]: post("http://127.0.0.1:5000/api", json=data).json() | |
In [5]: put("http://127.0.0.1:5000/api/123433199", json={"website": "www.example.com"}).json() | |
In [6]: delete("http://127.0.0.1:5000/api/123433199").json() |
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
# -*- coding: utf-8 -*- | |
from flask import Flask, jsonify, url_for, redirect, request | |
from flask_pymongo import PyMongo | |
from flask_restful import Api, Resource | |
app = Flask(__name__) | |
app.config["MONGO_DBNAME"] = "students_db" | |
mongo = PyMongo(app, config_prefix='MONGO') | |
APP_URL = "http://127.0.0.1:5000" |
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
" Use Vim settings, rather then Vi settings (much better!). | |
" This must be first, because it changes other options as a side effect. | |
set nocompatible | |
" TODO: this may not be in the correct place. It is intended to allow overriding <Leader>. | |
" source ~/.vimrc.before if it exists. | |
if filereadable(expand("~/.vimrc.before")) | |
source ~/.vimrc.before | |
endif |
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
class A(object): | |
def foo(self, x): | |
print "regular foo() method: %s %s" %(self, x) | |
@classmethod | |
def cls_foo(cls, x): | |
print "class method cls_foo(): %s %s" %(cls, x) |
NewerOlder