Bing
Classes
Attraction
Represents a tourist attraction identified in the image.
Attributes:
Name | Type | Description |
---|---|---|
url |
str
|
URL to the attraction's information page. |
title |
str
|
Name of the attraction. |
search_url |
str
|
URL for performing a new Bing search about this attraction. |
interest_types |
list[str]
|
Categories or types of interest for this attraction. |
Source code in PicImageSearch/model/bing.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
Attributes
interest_types: list[str] = data.get('interestTypes', [])
instance-attribute
search_url: str = data.get('requeryUrl', '')
instance-attribute
title: str = data.get('title', '')
instance-attribute
url: str = data.get('attractionUrl', '')
instance-attribute
Functions
__init__(data)
Source code in PicImageSearch/model/bing.py
90 91 92 93 94 |
|
BingItem
Bases: BaseSearchItem
Represents a single Bing search result item.
Attributes:
Name | Type | Description |
---|---|---|
origin |
dict
|
The raw JSON data of the search result item. |
title |
str
|
Title or name of the search result. |
url |
str
|
URL of the webpage containing the image. |
thumbnail |
str
|
URL of the thumbnail version of the image. |
image_url |
str
|
Direct URL to the full-size image. |
Source code in PicImageSearch/model/bing.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
Functions
__init__(data, **kwargs)
Initializes a BingItem with data from a search result.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict[str, Any]
|
A dictionary containing the search result data. |
required |
Source code in PicImageSearch/model/bing.py
17 18 19 20 21 22 23 |
|
BingResponse
Bases: BaseSearchResponse[BingItem]
Encapsulates the complete response from a Bing reverse image search.
This class processes and organizes various types of information returned by Bing's image search API, including similar images, related pages, entity information, and travel-related data.
Attributes:
Name | Type | Description |
---|---|---|
origin |
dict
|
The raw JSON response data. |
pages_including |
list[PagesIncludingItem]
|
Pages containing the searched image. |
visual_search |
list[VisualSearchItem]
|
Visually similar images. |
related_searches |
list[RelatedSearchItem]
|
Related search suggestions. |
best_guess |
Optional[str]
|
Bing's best guess for what the image represents. |
travel |
Optional[TravelInfo]
|
Travel-related information if applicable. |
entities |
list[EntityItem]
|
Entities identified in the image. |
url |
str
|
URL to the Bing search results page. |
Note
The actual content available in the response depends on what Bing's API identifies in the searched image. Not all attributes will contain data for every search.
Source code in PicImageSearch/model/bing.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
|
Functions
__init__(resp_data, resp_url, **kwargs)
Initialize a Bing search response.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resp_data
|
dict[str, Any]
|
The raw JSON response from Bing's API. |
required |
resp_url
|
str
|
The URL of the search results page. |
required |
**kwargs
|
Any
|
Additional keyword arguments passed to the parent class. |
{}
|
Source code in PicImageSearch/model/bing.py
193 194 195 196 197 198 199 200 201 |
|
EntityItem
Represents an entity (person, place, or thing) identified in the image.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Name of the identified entity. |
thumbnail |
str
|
URL to the entity's thumbnail image. |
description |
str
|
Detailed description of the entity. |
profiles |
list[dict]
|
List of social media profiles, each containing: - url (str): Profile URL - social_network (str): Name of the social network |
short_description |
str
|
Brief description or entity type. |
Source code in PicImageSearch/model/bing.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
Attributes
description: str = data.get('description', '')
instance-attribute
name: str = data.get('name', '')
instance-attribute
profiles: list[dict[str, str]] = []
instance-attribute
short_description: str = data.get('entityPresentationInfo', {}).get('entityTypeDisplayHint', '')
instance-attribute
thumbnail: str = data.get('image', {}).get('thumbnailUrl', '')
instance-attribute
Functions
__init__(data)
Source code in PicImageSearch/model/bing.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
PagesIncludingItem
Represents a webpage that contains the searched image.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Title of the webpage. |
thumbnail |
str
|
URL of the thumbnail image from this page. |
url |
str
|
URL of the webpage containing the image. |
image_url |
str
|
Direct URL to the image on this page. |
Source code in PicImageSearch/model/bing.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
Attributes
image_url: str = data.get('contentUrl', '')
instance-attribute
name: str = data.get('name', '')
instance-attribute
thumbnail: str = data.get('thumbnailUrl', '')
instance-attribute
url: str = data.get('hostPageUrl', '')
instance-attribute
Functions
__init__(data)
Source code in PicImageSearch/model/bing.py
56 57 58 59 60 |
|
RelatedSearchItem
Represents a related search suggestion from Bing's image search.
Attributes:
Name | Type | Description |
---|---|---|
text |
str
|
The suggested search query text. |
thumbnail |
str
|
URL of the thumbnail image associated with this suggestion. |
Source code in PicImageSearch/model/bing.py
33 34 35 36 37 38 39 40 41 42 43 |
|
Attributes
text: str = data.get('text', '')
instance-attribute
thumbnail: str = data.get('thumbnail', {}).get('url', '')
instance-attribute
Functions
__init__(data)
Source code in PicImageSearch/model/bing.py
41 42 43 |
|
TravelCard
Represents a travel-related information card from Bing.
Attributes:
Name | Type | Description |
---|---|---|
card_type |
str
|
Type or category of the travel card. |
title |
str
|
Title or heading of the card. |
url |
str
|
URL for more information about this travel topic. |
image_url |
str
|
URL of the main image on the card. |
image_source_url |
str
|
Source URL of the image used in the card. |
Source code in PicImageSearch/model/bing.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
|
Attributes
card_type: str = data.get('cardType', '')
instance-attribute
image_source_url: str = data.get('imageSourceUrl', '')
instance-attribute
image_url: str = data.get('image', '')
instance-attribute
title: str = data.get('title', '')
instance-attribute
url: str = data.get('clickUrl', '')
instance-attribute
Functions
__init__(data)
Source code in PicImageSearch/model/bing.py
108 109 110 111 112 113 |
|
TravelInfo
Contains comprehensive travel information related to the image.
Attributes:
Name | Type | Description |
---|---|---|
destination_name |
str
|
Name of the identified travel destination. |
travel_guide_url |
str
|
URL to Bing's travel guide for this destination. |
attractions |
list[Attraction]
|
List of related tourist attractions. |
travel_cards |
list[TravelCard]
|
Collection of related travel information cards. |
Source code in PicImageSearch/model/bing.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
Attributes
attractions: list[Attraction] = [Attraction(x) for x in data.get('attractions', [])]
instance-attribute
destination_name: str = data.get('destinationName', '')
instance-attribute
travel_cards: list[TravelCard] = [TravelCard(x) for x in data.get('travelCards', [])]
instance-attribute
travel_guide_url: str = data.get('travelGuideUrl', '')
instance-attribute
Functions
__init__(data)
Source code in PicImageSearch/model/bing.py
126 127 128 129 130 131 132 133 134 |
|
VisualSearchItem
Represents a visually similar image found by Bing's visual search.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Title or description of the similar image. |
thumbnail |
str
|
URL of the thumbnail version. |
url |
str
|
URL of the webpage containing this similar image. |
image_url |
str
|
Direct URL to the full-size similar image. |
Source code in PicImageSearch/model/bing.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
Attributes
image_url: str = data.get('contentUrl', '')
instance-attribute
name: str = data.get('name', '')
instance-attribute
thumbnail: str = data.get('thumbnailUrl', '')
instance-attribute
url: str = data.get('hostPageUrl', '')
instance-attribute
Functions
__init__(data)
Source code in PicImageSearch/model/bing.py
73 74 75 76 77 |
|