def sniff(url, *args, **kwargs):
""" Returns the media type for the given URL.
"""
return request(url, *args, **kwargs).headers.get('Content-Type', '').split(";")[0]
# print(sniff('http://www.textgain.com')) # 'text/html'
# Clear cache from 7+ days ago:
# t = time.time() - 7 * 24 * 60 * 60
# for f in glob.glob(cd(CACHE, '*')):
# if os.stat(f).st_ctime < t:
# os.remove(f)
#---- SEARCH --------------------------------------------------------------------------------------
# The Bing Search API grants 5,000 free requests per month.
# The Google Search API grants 100 free requests per day.
评论列表
文章目录