Registry / http-networking / favicon

favicon

JSON →
library0.7.0pypypi✓ verified 27d ago

favicon is a Python library designed to find and extract a website's favicon. It simplifies the process of locating favicons, which can be in various locations on a website. The current version is 0.7.0, released in August 2019. The release cadence appears to be infrequent.

pip install favicon
INSTALL
IMPORT
SIG · FAVICON
F
favicon
http-networkingpythonv0.7.0
Install
2.4s avg
Import
520ms
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.7.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.528s · 22.5MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.4s · import 0.512s · 23MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

get
✓ from favicon import get
✗ import favicon

This quickstart demonstrates how to import the `favicon` library and use its `get()` function to retrieve a list of `Favicon` objects for a given URL. It then prints the URL and dimensions of the first found favicon.

import favicon # Example URL url = "https://www.google.com" # Get all favicons for the URL icons = favicon.get(url) # The 'icons' variable is a list of Favicon objects. # Each Favicon object has attributes like .url, .width, .height, .format. if icons: # Print the URL of the first (and often best) favicon print(f"Found favicon URL: {icons[0].url}") # You can also access other properties print(f"Size: {icons[0].width}x{icons[0].height}") else: print(f"No favicons found for {url}")
Debug
Known issues
deprecatedThe `headers` argument in `favicon.get()` was deprecated in version 0.7.0. Passing a dictionary directly to `headers` will not work as expected.
fix
Instead of `favicon.get(url, headers={'User-Agent': 'my-agent'})`, pass keyword arguments directly to the function, e.g., `favicon.get(url, user_agent='my-agent')` or `favicon.get(url, **{'headers': {'User-Agent': 'my-agent'}})` if you need to pass a dictionary of headers.
affects: 0.7.0 and later
gotchaThe `favicon` library has not been updated since August 2019. While it generally works, it might not handle all modern favicon detection methods or edge cases found on newer websites. Consider alternative, more actively maintained libraries for complex scenarios.
fix
For websites where `favicon.get()` fails to find icons, manually inspect the page's HTML `<head>` for `<link rel="icon" ...>` tags or try a more robust, actively developed favicon extraction library like `extract-favicon` if more advanced features (e.g., async support, size guessing, DuckDuckGo/Google API fallbacks) are needed.
affects: 0.7.0
gotchaThe `favicon.get()` function returns a list of `Favicon` objects. It is common to assume only one favicon exists or to directly access `icons[0]`. However, a website might provide multiple favicons (e.g., different sizes, formats).
fix
Always check if the `icons` list is not empty before attempting to access elements like `icons[0]`. Iterate through the list if you need to inspect all available favicons or apply logic to select the 'best' one based on your criteria (e.g., largest size).
affects: All versions
Upgrade
Version history
0.7.0latest on PyPI · released Aug 31, 2019
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
Resources
favicon — pip install favicon · libregistry