Skip to main content

fetch bing image urls based on keywords

Project description

Bing-Image-Urls buildCode style: blackLicense: MITPyPI version

Fetch Bing image urls based on keywords

Installation

pip install bing-image-urls

Usage

from bing_image_urls import bing_image_urls

print(bing_iamge_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 widht 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.

import io
import httpx
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 the code in get_image_size is from imagesize_py. As soon as the PR about filelike object is merged to the main, the imagesize_py package will be included as a depdendant package.

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

bing-image-urls-0.1.3.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

bing_image_urls-0.1.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file bing-image-urls-0.1.3.tar.gz.

File metadata

  • Download URL: bing-image-urls-0.1.3.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.6.7 Windows/10

File hashes

Hashes for bing-image-urls-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e7810e10eec753dbe8db24828578426c1668086e96b4f7597dffa26f4aed9347
MD5 a99bd88f846954b7af8a947248fb7689
BLAKE2b-256 e54ebbb95652b3c50d7f9d895f6d37a70f652887d740ce81373397097a2dd8ba

See more details on using hashes here.

File details

Details for the file bing_image_urls-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: bing_image_urls-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.6.7 Windows/10

File hashes

Hashes for bing_image_urls-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 523fba1fd0907bd7e53cc24e9ffd0c6be66d14052453db8df19ef2dc0e5a5492
MD5 d260cb1288575a1985574475fce0db55
BLAKE2b-256 031b438d89294b49136f2b6afb10c262f27a70c4749c5d94a0fcabc5c4baaf42

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