本文整理汇总了Python中api.API.using_request方法的典型用法代码示例。如果您正苦于以下问题:Python API.using_request方法的具体用法?Python API.using_request怎么用?Python API.using_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api.API
的用法示例。
在下文中一共展示了API.using_request方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: user_threads
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import using_request [as 别名]
def user_threads():
username = request.args.get('id')
api = API.using_request(request)
api_response = api.user(username, 'threads')
rss_title = 'Hacker News: %s threads RSS feed' % username
rss_link = 'https://news.ycombinator.com/threads?id=%s' % username
rss = RSS(api_response, rss_title, rss_link)
return rss.response()
示例2: new_comments
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import using_request [as 别名]
def new_comments():
query = request.args.get('q')
api = API.using_request(request)
if query:
rss_title = 'Hacker News: "%s" comments' % query
else:
rss_title = 'Hacker News: New Comments'
rss = RSS(api.comments(), rss_title, 'https://news.ycombinator.com/newcomments')
return rss.response()
示例3: who_is_hiring
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import using_request [as 别名]
def who_is_hiring(include=None):
api = API.using_request(request)
if include is None:
rss = RSS(api.who_is_hiring('all'), 'whoishiring', 'https://news.ycombinator.com/submitted?id=whoishiring')
elif include == 'jobs':
rss = RSS(api.who_is_hiring(include), 'whoishiring - Who is hiring?', 'https://news.ycombinator.com/submitted?id=whoishiring')
elif include == 'hired':
rss = RSS(api.who_is_hiring(include), 'whoishiring - Who wants to be hired?', 'https://news.ycombinator.com/submitted?id=whoishiring')
elif include == 'freelance':
rss = RSS(api.who_is_hiring(include), 'whoishiring - Freelancer? Seeking freelancer?', 'https://news.ycombinator.com/submitted?id=whoishiring')
return rss.response()
示例4: story_comments
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import using_request [as 别名]
def story_comments():
story_id = request.args.get('id')
api = API.using_request(request)
api_response = api.comments(story_id=story_id)
if api_response['hits']:
story = api_response['hits'][0]
rss_title = 'Hacker News: New Comments on "%s"' % story['story_title']
else:
rss_title = 'Hacker News: New Comments'
rss_link = 'https://news.ycombinator.com/item?id=%s' % story_id
rss = RSS(api_response, rss_title, rss_link)
return rss.response()
示例5: polls
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import using_request [as 别名]
def polls():
api = API.using_request(request)
rss = RSS(api.polls(), 'Hacker News: Polls')
return rss.response()
示例6: show
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import using_request [as 别名]
def show():
api = API.using_request(request)
rss = RSS(api.show_hn(), 'Hacker News: Show HN')
return rss.response()
示例7: ask
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import using_request [as 别名]
def ask():
api = API.using_request(request)
rss = RSS(api.ask_hn(), 'Hacker News: Ask HN', 'https://news.ycombinator.com/ask')
return rss.response()
示例8: jobs
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import using_request [as 别名]
def jobs():
api = API.using_request(request)
rss = RSS(api.jobs(), 'Hacker News: Jobs', 'https://news.ycombinator.com/jobs')
return rss.response()
示例9: show
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import using_request [as 别名]
def show():
api = API.using_request(request)
rss = RSS(api.show_hn(), 'Hacker News: Show HN', 'https://news.ycombinator.com/shownew')
return rss.response()
示例10: frontpage
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import using_request [as 别名]
def frontpage():
api = API.using_request(request)
rss_title = 'Hacker News: Front Page'
rss = RSS(api.frontpage(), rss_title, 'https://news.ycombinator.com/')
return rss.response()