示例#1
0
文件: crawler.py 项目: adirkuhn/creu
    def save_author(self, author_url, author_name, author_twitter, author_bio):
        author = Author.query.filter(Author.url == author_url).first()
        if (isinstance(author, Author) == False):
            author = Author()
            author.url = author_url
            author.name = author_name
            author.twitter = author_twitter
            author.bio = author_bio

            db.session.add(author)
            db.session.commit()
            db.session.refresh(author)

        return author
示例#2
0
文件: crawler.py 项目: adirkuhn/creu
    def save_author(self, author_url, author_name, author_twitter, author_bio):
        author = Author.query.filter(Author.url == author_url).first()
        if (isinstance(author, Author) == False):
            author = Author()
            author.url = author_url
            author.name = author_name
            author.twitter = author_twitter
            author.bio = author_bio

            db.session.add(author)
            db.session.commit()
            db.session.refresh(author)

        return author