Created
December 11, 2013 20:27
-
-
Save amitm/7917865 to your computer and use it in GitHub Desktop.
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
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