本文整理汇总了Python中model.Tag.nome方法的典型用法代码示例。如果您正苦于以下问题:Python Tag.nome方法的具体用法?Python Tag.nome怎么用?Python Tag.nome使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Tag
的用法示例。
在下文中一共展示了Tag.nome方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: extract_comments
# 需要导入模块: from model import Tag [as 别名]
# 或者: from model.Tag import nome [as 别名]
def extract_comments():
paragraphs = get_paragraphs()
for i in paragraphs:
# Creating the paragraph object. It will be stored in a
# relational database by elixir+sqlalchemy :)
paragrafo = Paragrafo()
paragrafo.id = i
# Building and dispatching the request to get comment data
query = {'method': 'get_paragraph_comments',
'params': [i, HARDCODED_POST_ID]}
page = urllib.urlopen(API_URL % simplejson.dumps(query))
json = simplejson.loads(page.read())
for c in json:
# Time to save collected things in the database
comentario = Comentario()
comentario.id = int(c['comment_ID'])
comentario.navegador = c['comment_agent']
comentario.autor = c['comment_author']
comentario.autor_url = c['comment_author_url']
comentario.instituicao = c['instituicao']
comentario.contribuicao = c['meta']['contribuicao']
comentario.justificativa = c['meta']['justificativa']
comentario.opiniao = c['meta']['opiniao']
comentario.proposta = c['meta']['proposta']
comentario.data = datetime.strptime(
c['comment_date'], '%Y-%m-%d %H:%M:%S')
comentario.paragrafo = paragrafo
# Time to add the comment tags
for t in c['tags']:
tag = Tag()
tag.nome = t['name']
comentario.tags.append(tag)
session.commit()