Skip to main content

Get a website's favicon.

Project description

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


pip install favicon


Get all icons:

>>> import favicon
>>> icons = favicon.get('')
Icon(url='', width=144, height=144, format='png')
Icon(url='', width=114, height=114, format='png')
Icon(url='', width=72, height=72, format='png')
Icon(url='', width=0, height=0, format='png')
Icon(url='', width=0, height=0, format='ico')

Download largest icon:

import requests
import favicon

icons = favicon.get('')
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):

# /tmp/python-favicon.png

Request library parameters can be passed to favicon.get() as keyword arguments:

import favicon

user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'
headers = {'User-Agent': user_agent}
favicon.get('', headers=headers, timeout=2)



0.7.0 (2019-08-31)

  • Handle empty href and content attribute values (#22).
  • Support passing request library parameters to favicon.get() (#21).
    • Deprecate headers argument. Use keyword arguments: favicon.get(url, headers={‘User-Agent’; ‘my-agent’}.

0.6.0 (2019-08-10)

  • Upgrade beautifulsoup4 and requests package dependencies.

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 (#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.

Files for favicon, version 0.7.0
Filename, size File type Python version Upload date Hashes
Filename, size favicon-0.7.0-py2.py3-none-any.whl (5.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size favicon-0.7.0.tar.gz (9.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page