Skip to main content

`URLicon` helps you to discover an possible icon from a URL.

Project description

URLicon - v0.2.6

URLicon helps you to discover an possible icon from a URL.

We check for the metatag icons, favicons and, if we don't find, we check the first image in the URL html code. Finally, if nothing is found, we use the https://ui-avatars.com/api/ to bring you at least some avatar-like icon.

How to install and use

Install with uv or pip

uv add urlicon
# or
pip urlicon

Usage:

from urlicon import urlicon

url = "https://this-is.your-url.com/some-path"

icon_url = urlicon.get_url_icon(url)

print("icon:", icon_url)
# icon: "https://this-is.your-url.com/icon.jpeg"

Caching

URLicon use the unforgettable "cache" to avoid unecessary URL requests. It uses a temp dir for each execution. But you can define a your own directory and use the cache as much as you want setting SIMPLE_CACHE_ROOT_DIR env var.

SIMPLE_CACHE_ROOT_DIR = os.getenv("SIMPLE_CACHE_ROOT_DIR", None)
cache = unforgettable(cache_folder=SIMPLE_CACHE_ROOT_DIR)

And you can clean the cache with:

urlicon.unforgettable.clean()

See Also

License

This package is distributed under the MIT license.

Project details


Download files

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

Source Distribution

urlicon-0.2.6.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

urlicon-0.2.6-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file urlicon-0.2.6.tar.gz.

File metadata

  • Download URL: urlicon-0.2.6.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for urlicon-0.2.6.tar.gz
Algorithm Hash digest
SHA256 164c2fad58e031a50579b2f7fa8a04871da981e2db81e84bfa8f0f43c9c70335
MD5 b1f159eac08d4f9705f859eae004d477
BLAKE2b-256 1a8ea901ef0f6afd9cba707efaadc0b515a06ba0c55bd94c09f37d98f5dffcff

See more details on using hashes here.

Provenance

The following attestation bundles were made for urlicon-0.2.6.tar.gz:

Publisher: publish-pypi.yml on bouli/urlicon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file urlicon-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: urlicon-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for urlicon-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ee2a51485adfd0c2784321148c0429d689dd462d34047688f708935340cebc83
MD5 8d7a5b7c688937ff20033478cf78d114
BLAKE2b-256 9f9361cd810ecbef9841303199c24592a3cd686ae11116e15712fbe91f2e5829

See more details on using hashes here.

Provenance

The following attestation bundles were made for urlicon-0.2.6-py3-none-any.whl:

Publisher: publish-pypi.yml on bouli/urlicon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page