Skip to main content

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

Project description

URLicon - v0.2.5

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.5.tar.gz (3.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.5-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: urlicon-0.2.5.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for urlicon-0.2.5.tar.gz
Algorithm Hash digest
SHA256 01bda4dca827469181e9b874506b0dfb9de1f68bd70dcf379c737e403cc69f9f
MD5 80f6d4b7e644b423fbfcbd28b7226590
BLAKE2b-256 915d8745d39d7f6967d4bfe125e9a2b6b5e6317e18beb8e9666ca9d6352aba16

See more details on using hashes here.

File details

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

File metadata

  • Download URL: urlicon-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for urlicon-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ad687e759d97d2dd4a742b206c22fa561adbe9b628e498d7121359060b728d8c
MD5 b2e657f583fa5e7a25abcd742811fd7e
BLAKE2b-256 662df72f3659746e8afdcc2e3402377645ca57c828a96c49ec15ab91b5d35602

See more details on using hashes here.

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