Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Get a website's favicon.

Project description

favicon is a Python library to find a website’s favicon.

Installation

pip install favicon

Usage

Get all icons:

>>> import favicon
>>> icons = favicon.get('https://www.python.org/')
Icon(url='https://www.python.org/static/apple-touch-icon-144x144-precomposed.png', width=144, height=144, format='png')
Icon(url='https://www.python.org/static/apple-touch-icon-114x114-precomposed.png', width=114, height=114, format='png')
Icon(url='https://www.python.org/static/apple-touch-icon-72x72-precomposed.png', width=72, height=72, format='png')
Icon(url='https://www.python.org/static/apple-touch-icon-precomposed.png', width=0, height=0, format='png')
Icon(url='https://www.python.org/static/favicon.ico', width=0, height=0, format='ico')

Download largest icon:

import requests
import favicon

icons = favicon.get('https://www.python.org/')
icon = icons[0]

response = requests.get(icon.url, stream=True)
with open('/tmp/python-favicon.{}'.format(icon.format), 'wb') as image:
    for chunk in response.iter_content(1024):
        image.write(chunk)

# /tmp/python-favicon.png

Requirements

Changelog

0.5.1 (2018-11-05)

  • Fix ‘NoneType’ object has no attribute ‘lower’ for meta tags (#16).

0.5.0 (2018-11-05)

  • Add support for meta tags (#15).
  • Set bs4 parser to html.parser (#13).
  • Use src package structure (#11).

0.4.1 (2018-10-01)

  • Update requirements.txt and dev-requirements.txt.

0.4.0 (2018-07-19)

  • Add support for Python 2.7 and PyPy.
  • Get icon size for New York Times (#9).

0.3.0 (2018-05-18)

  • Fav icon not found for microsoft.com (#7).

0.2.0 (2018-05-17)

  • Handle poor html values in links (#5).
  • Use given website for icon url scheme (#6).

0.1.0 (2018-05-07)

  • First release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
favicon-0.5.1-py2.py3-none-any.whl (5.6 kB) Copy SHA256 hash SHA256 Wheel py2.py3
favicon-0.5.1.tar.gz (8.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page