Skip to content

Instantly share code, notes, and snippets.

View dionimf's full-sized avatar

Dioni dionimf

View GitHub Profile
import urllib
import json
from pprint import pprint
url = 'https://graph.facebook.com/fmasanori'
resp = urllib.urlopen(url).read()
data = json.loads(resp)
pprint(data)
import urllib
url = 'https://graph.facebook.com/1183621847/picture?type=large'
imagem = urllib.urlopen(url).read()
f = open('foto.jpg', 'wb')
f.write(imagem)
f.close()
print ('Foto do perfil gravada...')
from datetime import datetime
from pymongo import Connection
connection = Connection('localhost', 27017)
db = connection.test
post = {"title": "My Blog Post",
"content": "Here's my blog post.",
"date": datetime.utcnow()}
import bottle
import pymongo
@bottle.route('/')
def index():
from pymongo import Connection
connection = Connection('localhost', 27017)
db = connection.test
names = db.names
import pymongo
import sys
def main():
connection = pymongo.Connection('localhost', safe=True)
db = connection.m101
people = db.people
person = {'name': 'Barack Obama', 'role':'President',
'address':{'address1':'The White House',
'street': '1600 Pensylvania Avenue',
import bottle
#this is the handler for the root address on the web browser
@bottle.route('/')
def home_page():
return 'Hello Bottle World\n'
@bottle.route('/testpage')
def test_page():
return 'Oficina MongoDB e Python no FISL 2013'
import bottle
@bottle.route('/')
def home_page():
mythings = ['apple', 'orange', 'banana', 'peach']
return bottle.template('hello_world', {'username':'Masanori',
'things':mythings})
bottle.debug(True)
<!DOCTYPE html>
<html>
<head>
<title>Hello World!</title>
</head>
<body>
<p>
Welcome {{username}}
<p>
<ul>
import bottle
@bottle.route('/')
def home_page():
mythings = ['apple', 'orange', 'banana', 'peach']
return bottle.template('hello_world2', {'username':'Masanori',
'things':mythings})
@bottle.post('/favorite_fruit')
def favorite_fruit():
fruit = bottle.request.forms.get('fruit')
<!DOCTYPE html>
<html>
<head>
<title>Hello World!</title>
</head>
<body>
<p>
Welcome {{username}}
<p>
<ul>