========
favicon
========
``favicon`` is a Python library to find a website's favicon.
Installation
============
.. code-block:: bash
pip install favicon
Usage
=====
Get all icons:
.. code-block:: python
>>> 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:
.. code-block:: python
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
`Request library <https://2.python-requests.org/>`_ parameters can be passed to `favicon.get()` as keyword
arguments:
.. code-block:: python
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('https://www.python.org/', headers=headers, timeout=2)
Requirements
============
* `requests <http://docs.python-requests.org/>`_
* `beautifulsoup4 <https://www.crummy.com/software/BeautifulSoup/bs4/doc/>`_
Inspiration
===========
* `pyfav <https://github.com/phillipsm/pyfav>`_
* `besticon <https://github.com/mat/besticon/>`_
* `How to get high resolution website logo (favicon) for a given URL <https://stackoverflow.com/questions/21991044/how-to-get-high-resolution-website-logo-favicon-for-a-given-url>`_
Changelog
=========
0.7.0 (2019-08-31)
------------------
* Handle empty `href` and `content` attribute values (`#22 <https://github.com/scottwernervt/favicon/issues/22>`_).
* Support passing request library parameters to `favicon.get()` (`#21 <https://github.com/scottwernervt/favicon/issues/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 <https://github.com/scottwernervt/favicon/issues/16>`_).
0.5.0 (2018-11-05)
------------------
* Add support for meta tags (`#15 <https://github.com/scottwernervt/favicon/pull/15>`_).
* Set bs4 parser to ``html.parser`` (`#13 <https://github.com/scottwernervt/favicon/issues/13>`_).
* Use ``src`` package structure (`#11 <https://github.com/scottwernervt/favicon/issues/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 <https://github.com/scottwernervt/favicon/issues/9>`_).
0.3.0 (2018-05-18)
------------------
* Fav icon not found for microsoft.com (`#7 <https://github.com/scottwernervt/favicon/issues/7>`_).
0.2.0 (2018-05-17)
------------------
* Handle poor html values in links (`#5 <https://github.com/scottwernervt/favicon/issues/5>`_).
* Use given website for icon url scheme (`#6 <https://github.com/scottwernervt/favicon/issues/6>`_).
0.1.0 (2018-05-07)
------------------
* First release.
Raw data
{
"_id": null,
"home_page": "https://github.com/scottwernervt/favicon",
"name": "favicon",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "favicon icon",
"author": "Scott Werner",
"author_email": "scott.werner.vt@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/64/68/d2646f40c05d3a501cddd232119f8c087a6fcba3c79255a062c73e80b42a/favicon-0.7.0.tar.gz",
"platform": "",
"description": "========\nfavicon\n========\n\n\n\n``favicon`` is a Python library to find a website's favicon.\n\nInstallation\n============\n\n.. code-block:: bash\n\n pip install favicon\n\nUsage\n=====\n\nGet all icons:\n\n.. code-block:: python\n\n >>> import favicon\n >>> icons = favicon.get('https://www.python.org/')\n Icon(url='https://www.python.org/static/apple-touch-icon-144x144-precomposed.png', width=144, height=144, format='png')\n Icon(url='https://www.python.org/static/apple-touch-icon-114x114-precomposed.png', width=114, height=114, format='png')\n Icon(url='https://www.python.org/static/apple-touch-icon-72x72-precomposed.png', width=72, height=72, format='png')\n Icon(url='https://www.python.org/static/apple-touch-icon-precomposed.png', width=0, height=0, format='png')\n Icon(url='https://www.python.org/static/favicon.ico', width=0, height=0, format='ico')\n\nDownload largest icon:\n\n.. code-block:: python\n\n import requests\n import favicon\n\n icons = favicon.get('https://www.python.org/')\n icon = icons[0]\n\n response = requests.get(icon.url, stream=True)\n with open('/tmp/python-favicon.{}'.format(icon.format), 'wb') as image:\n for chunk in response.iter_content(1024):\n image.write(chunk)\n\n # /tmp/python-favicon.png\n\n`Request library <https://2.python-requests.org/>`_ parameters can be passed to `favicon.get()` as keyword\narguments:\n\n.. code-block:: python\n\n import favicon\n\n 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'\n headers = {'User-Agent': user_agent}\n favicon.get('https://www.python.org/', headers=headers, timeout=2)\n\nRequirements\n============\n\n* `requests <http://docs.python-requests.org/>`_\n* `beautifulsoup4 <https://www.crummy.com/software/BeautifulSoup/bs4/doc/>`_\n\nInspiration\n===========\n\n* `pyfav <https://github.com/phillipsm/pyfav>`_\n* `besticon <https://github.com/mat/besticon/>`_\n* `How to get high resolution website logo (favicon) for a given URL <https://stackoverflow.com/questions/21991044/how-to-get-high-resolution-website-logo-favicon-for-a-given-url>`_\n\nChangelog\n=========\n\n0.7.0 (2019-08-31)\n------------------\n\n* Handle empty `href` and `content` attribute values (`#22 <https://github.com/scottwernervt/favicon/issues/22>`_).\n* Support passing request library parameters to `favicon.get()` (`#21 <https://github.com/scottwernervt/favicon/issues/21>`_).\n\n * Deprecate `headers` argument. Use keyword arguments: `favicon.get(url, headers={'User-Agent'; 'my-agent'}`.\n\n0.6.0 (2019-08-10)\n------------------\n\n* Upgrade ``beautifulsoup4`` and ``requests`` package dependencies.\n\n0.5.1 (2018-11-05)\n------------------\n\n* Fix 'NoneType' object has no attribute 'lower' for meta tags (`#16 <https://github.com/scottwernervt/favicon/issues/16>`_).\n\n0.5.0 (2018-11-05)\n------------------\n\n* Add support for meta tags (`#15 <https://github.com/scottwernervt/favicon/pull/15>`_).\n* Set bs4 parser to ``html.parser`` (`#13 <https://github.com/scottwernervt/favicon/issues/13>`_).\n* Use ``src`` package structure (`#11 <https://github.com/scottwernervt/favicon/issues/11>`_).\n\n0.4.1 (2018-10-01)\n------------------\n\n* Update ``requirements.txt`` and ``dev-requirements.txt``.\n\n0.4.0 (2018-07-19)\n------------------\n\n* Add support for Python 2.7 and PyPy.\n* Get icon size for New York Times (`#9 <https://github.com/scottwernervt/favicon/issues/9>`_).\n\n0.3.0 (2018-05-18)\n------------------\n\n* Fav icon not found for microsoft.com (`#7 <https://github.com/scottwernervt/favicon/issues/7>`_).\n\n0.2.0 (2018-05-17)\n------------------\n\n* Handle poor html values in links (`#5 <https://github.com/scottwernervt/favicon/issues/5>`_).\n* Use given website for icon url scheme (`#6 <https://github.com/scottwernervt/favicon/issues/6>`_).\n\n0.1.0 (2018-05-07)\n------------------\n\n* First release.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Get a website's favicon.",
"version": "0.7.0",
"project_urls": {
"Homepage": "https://github.com/scottwernervt/favicon"
},
"split_keywords": [
"favicon",
"icon"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "934c8baf94bb789972634d933152d27529f2bad4e5d2397b8da9c30f6f5342ce",
"md5": "7c2571884d68b52cb5a81bc87b7b4a8e",
"sha256": "7fec0617c73dcb8521ea788e1d38cdc7226c7cb8e28c81e11625d85fa1534880"
},
"downloads": -1,
"filename": "favicon-0.7.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "7c2571884d68b52cb5a81bc87b7b4a8e",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 5921,
"upload_time": "2019-08-31T16:56:40",
"upload_time_iso_8601": "2019-08-31T16:56:40.751744Z",
"url": "https://files.pythonhosted.org/packages/93/4c/8baf94bb789972634d933152d27529f2bad4e5d2397b8da9c30f6f5342ce/favicon-0.7.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6468d2646f40c05d3a501cddd232119f8c087a6fcba3c79255a062c73e80b42a",
"md5": "7f5928d0cda8b6dd79b0452942fe57f5",
"sha256": "6d6b5a78de2a0d0084589f687f384b2ecd6a6527093fec564403b1a30605d7a8"
},
"downloads": -1,
"filename": "favicon-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "7f5928d0cda8b6dd79b0452942fe57f5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9284,
"upload_time": "2019-08-31T16:56:42",
"upload_time_iso_8601": "2019-08-31T16:56:42.464065Z",
"url": "https://files.pythonhosted.org/packages/64/68/d2646f40c05d3a501cddd232119f8c087a6fcba3c79255a062c73e80b42a/favicon-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2019-08-31 16:56:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "scottwernervt",
"github_project": "favicon",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "favicon"
}