i-need-an-image
Download only one image from web, only one API.
从互联网中仅下载一张图片,使用时仅需一个接口。
Only support "Bing Image" for now.
现在只支持必应图片。
Developing...
根据自己的项目需求,开发中...
确保可以从互联网上获取一张符合条件图片。可以指定图片的以下特征:
- 关键词或一句话里的某个关键词(后续可能会移除提取关键词的功能)
- 图片的版式:横板、竖版、方形
我的关注点是尽可能地提高获取图片的成功率,可以通过不同细粒度的重试来达到这一目标:
- 请求图片实际地址失败时进行重试。
- 对同一搜索页面的不同图片进行请求尝试。
- 尝试不同的来源网站(必应、百度、谷歌)。
架构愿景:
- 希望可以像
Scrapy的流水线一样,不同来源的下载器可随意插拔和扩展。 - 入口点只有一个
need_image_from()函数。
Installation 安装
pip install i-need-an-image
Usage 使用方式
>>> from need_an_image import need_image_from
# Get PIL Image object
>>> need_image_from('bing', keyword='Tom')
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=800x1200 at 0x12594FE0EB0>
# Save image to disk
>>> need_image_from('bing', keyword='Tom', save_to='.')
'.\\2f65cbef7b8944cd93d21d434e566bf3.jpg'
Metadata
Release files for i-need-an-image 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| i-need-an-image-0.3.4.tar.gz | 5.2 kB | Without provenance | Details for i-need-an-image-0.3.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| i_need_an_image-0.3.4-py3-none-any.whl | Python 3 | none | any | Details for i_need_an_image-0.3.4-py3-none-any.whl |
Total release size: 11.3 kB
Release files / i-need-an-image-0.3.4.tar.gz
| Download URL | i-need-an-image-0.3.4.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0160a2194cf72e05cad597b05c6c1839a7c4a6ef28e7598aaf4cf86b326ee23e
|
|
BLAKE2b-256 checksum How to use checksums |
5095f08a191b5d69bee3aa68686e1a6e7c1ae659347687a1282f67abe2a74314
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
|
Release files / i_need_an_image-0.3.4-py3-none-any.whl
| Download URL | i_need_an_image-0.3.4-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c43ac04a609c1b756f32fddbb14795310c93f90a33543e2cd3cdf672aa66a22d
|
|
BLAKE2b-256 checksum How to use checksums |
af85d62513abf552f664151f89055208a51f2f6af34f50b56db99ce6376e9268
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
|
Security for i-need-an-image 0.3.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.