bing-image-urls-0.1.5
توضیحات
fetch bing image urls based on keywords
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | bing-image-urls-0.1.5 |
| نام | bing-image-urls |
| نسخه کتابخانه | 0.1.5 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | ffreemt |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/ffreemt/bing-image-urls |
| آدرس اینترنتی | https://pypi.org/project/bing-image-urls/ |
| مجوز | - |
# Bing-Image-Urls [](https://github.com/psf/black)[](https://opensource.org/licenses/MIT)[](https://badge.fury.io/py/bing-image-urls)
Fetch Bing image urls based on keywords
### Installation
```pip install bing-image-urls```
### Usage
```python
from bing_image_urls import bing_image_urls
print(bing_image_urls("bear", limit=2))
# ['https://www.stgeorgeutah.com/wp-content/uploads/2017/01/blackbear.jpg',
# 'http://www.cariboutrailoutfitters.com/wp-content/uploads/2017/03/saskatchewan-black-bear-hunting.jpg']
```
The helper function `get_image_size` may sometimes come handy if you need to know the size of the image. `get_image_size` takes a filename or a filelike object as input and outputs the width and height of the image. Hence the raw bytes of an image from the net can be wrapped in io.BytesIO and fed to `get_image_size`.
```python
import io
import httpx
from logzero import logger
from bing_image_urls import get_image_size
url = "https://www.stgeorgeutah.com/wp-content/uploads/2017/01/blackbear.jpg"
try:
resp = httpx.get(url)
resp.raise_for_status()
except Exception as exc:
raise SystemExit(exc)
print(get_image_size(io.BytesIO(resp.content)))
# (1797, 2696)
```
Most of the code in `get_image_size` is from [imagesize_py](https://github.com/shibukawa/imagesize_py). As soon as the [PR](https://github.com/shibukawa/imagesize_py/pull/46) about filelike object is merged to the main branch, the `imagesize_py` package will be included as a depdendant package.
نیازمندی
| مقدار | نام |
|---|---|
| >=0.23.1,<0.24.0 | httpx |
| >=1.5.0,<2.0.0 | logzero |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7.0,<4.0.0 | Python |
نحوه نصب
نصب پکیج whl bing-image-urls-0.1.5:
pip install bing-image-urls-0.1.5.whl
نصب پکیج tar.gz bing-image-urls-0.1.5:
pip install bing-image-urls-0.1.5.tar.gz