Skip to content

Instantly share code, notes, and snippets.

@amitm
Created December 11, 2013 20:27
Show Gist options
  • Save amitm/7917865 to your computer and use it in GitHub Desktop.
Save amitm/7917865 to your computer and use it in GitHub Desktop.
from database import db, Base
from sqlalchemy import Column, String, Text
from tornado import gen
from tornado.httpclient import AsyncHTTPClient
class Bookmark(Base):
url = Column(Text, nullable=False)
data = Column(Text)
@gen.coroutine
def fetch_data(self):
http = AsyncHTTPClient()
response = yield http.fetch(self.url)
self.data = response.body
db.commit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment