grasp.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:grasp 作者: textgain 项目源码 文件源码
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.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号