This commit is contained in:
unknown 2021-02-11 15:11:43 +02:00
Родитель 83a0e8829b
Коммит 137af85930
11 изменённых файлов: 26 добавлений и 25 удалений

Просмотреть файл

@ -12,7 +12,7 @@ sys.path.insert(0, current_dir)
# Add your Bing Autosuggest subscription key to your environment variables. # Add your Bing Autosuggest subscription key to your environment variables.
SUBSCRIPTION_KEY = "00000000000000000000000000" SUBSCRIPTION_KEY = None
ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/" ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/"
def autosuggest_lookup(subscription_key): def autosuggest_lookup(subscription_key):
"""AutoSuggestLookup. """AutoSuggestLookup.

Просмотреть файл

@ -10,7 +10,7 @@ sys.path.insert(0, current_dir)
# Add your Bing Autosuggest subscription key to your environment variables. # Add your Bing Autosuggest subscription key to your environment variables.
SUBSCRIPTION_KEY = "00000000000000000000000000" SUBSCRIPTION_KEY = None
ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/" ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/"

Просмотреть файл

@ -11,7 +11,7 @@ sys.path.insert(0, current_dir)
# Add your Bing Autosuggest subscription key to your environment variables. # Add your Bing Autosuggest subscription key to your environment variables.
SUBSCRIPTION_KEY = "00000000000000000000000000" SUBSCRIPTION_KEY = None
ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/" ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/"
#SUBSCRIPTION_KEY = os.environ['BING_CUSTOM_SEARCH_SUBSCRIPTION_KEY'] #SUBSCRIPTION_KEY = os.environ['BING_CUSTOM_SEARCH_SUBSCRIPTION_KEY']

Просмотреть файл

@ -13,7 +13,7 @@ sys.path.insert(0, current_dir)
#SUBSCRIPTION_KEY = os.environ['BING_ENTITY_SEARCH_SUBSCRIPTION_KEY'] #SUBSCRIPTION_KEY = os.environ['BING_ENTITY_SEARCH_SUBSCRIPTION_KEY']
#ENDPOINT = os.environ['BING_ENTITY_SEARCH_ENDPOINT'] #ENDPOINT = os.environ['BING_ENTITY_SEARCH_ENDPOINT']
SUBSCRIPTION_KEY = "00000000000000000000000000" SUBSCRIPTION_KEY = None
ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/" ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/"
def dominant_entity_lookup(subscription_key): def dominant_entity_lookup(subscription_key):

Просмотреть файл

@ -13,7 +13,7 @@ sys.path.insert(0, current_dir)
#SUBSCRIPTION_KEY = os.environ['BING_SEARCH_V7_SUBSCRIPTION_KEY'] #SUBSCRIPTION_KEY = os.environ['BING_SEARCH_V7_SUBSCRIPTION_KEY']
#ENDPOINT = os.environ['BING_ENTITY_SEARCH_ENDPOINT'] #ENDPOINT = os.environ['BING_ENTITY_SEARCH_ENDPOINT']
SUBSCRIPTION_KEY = "00000000000000000000000000" SUBSCRIPTION_KEY = None
ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/" ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/"
search_term = "canadian rockies" search_term = "canadian rockies"
@ -21,18 +21,19 @@ search_term = "canadian rockies"
""" """
This application will search images on the web with the Bing Image Search API and print out first image result. This application will search images on the web with the Bing Image Search API and print out first image result.
""" """
# create the image search client if SUBSCRIPTION_KEY:
client = ImageSearchClient(AzureKeyCredential(SUBSCRIPTION_KEY)) # create the image search client
# send a search query to the Bing Image Search API client = ImageSearchClient(AzureKeyCredential(SUBSCRIPTION_KEY))
image_results = client.images.search(query=search_term) # send a search query to the Bing Image Search API
print("Searching the web for images of: {}".format(search_term)) image_results = client.images.search(query=search_term)
print("Searching the web for images of: {}".format(search_term))
# Image results # Image results
if image_results.value: if image_results.value:
first_image_result = image_results.value[0] first_image_result = image_results.value[0]
print("Total number of images returned: {}".format(len(image_results.value))) print("Total number of images returned: {}".format(len(image_results.value)))
print("First image thumbnail url: {}".format( print("First image thumbnail url: {}".format(
first_image_result.thumbnail_url)) first_image_result.thumbnail_url))
print("First image content url: {}".format(first_image_result.content_url)) print("First image content url: {}".format(first_image_result.content_url))
else: else:
print("Couldn't find image results!") print("Couldn't find image results!")

Просмотреть файл

@ -12,7 +12,7 @@ sys.path.insert(0, current_dir)
#SUBSCRIPTION_KEY = os.environ["BING_IMAGE_SEARCH_SUBSCRIPTION_KEY"] #SUBSCRIPTION_KEY = os.environ["BING_IMAGE_SEARCH_SUBSCRIPTION_KEY"]
#ENDPOINT = os.environ['BING_IMAGE_SEARCH_ENDPOINT'] #ENDPOINT = os.environ['BING_IMAGE_SEARCH_ENDPOINT']
SUBSCRIPTION_KEY = "00000000000000000000000000" SUBSCRIPTION_KEY = None
ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/" ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/"
def image_search(subscription_key): def image_search(subscription_key):

Просмотреть файл

@ -10,7 +10,7 @@ sys.path.insert(0, current_dir)
# Add your Bing Autosuggest subscription key to your environment variables. # Add your Bing Autosuggest subscription key to your environment variables.
SUBSCRIPTION_KEY = "00000000000000000000000000" SUBSCRIPTION_KEY = None
ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/" ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/"
# Add your Bing Search V7 subscription key to your environment variables. # Add your Bing Search V7 subscription key to your environment variables.

Просмотреть файл

@ -11,7 +11,7 @@ sys.path.insert(0, current_dir)
# Add your Bing Spell Check subscription key to your environment variables. # Add your Bing Spell Check subscription key to your environment variables.
#SUBSCRIPTION_KEY = os.environ['BING_SPELL_CHECK_SUBSCRIPTION_KEY'] #SUBSCRIPTION_KEY = os.environ['BING_SPELL_CHECK_SUBSCRIPTION_KEY']
SUBSCRIPTION_KEY = "00000000000000000000000000" SUBSCRIPTION_KEY = None
ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/" ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/"
def spellcheck(subscription_key): def spellcheck(subscription_key):

Просмотреть файл

@ -11,7 +11,7 @@ sys.path.insert(0, current_dir)
# Add your Bing Autosuggest subscription key to your environment variables. # Add your Bing Autosuggest subscription key to your environment variables.
SUBSCRIPTION_KEY = "00000000000000000000000000" SUBSCRIPTION_KEY = None
ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/" ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/"

Просмотреть файл

@ -18,7 +18,7 @@ sys.path.insert(0, current_dir)
# Add your Bing Autosuggest subscription key to your environment variables. # Add your Bing Autosuggest subscription key to your environment variables.
ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/" ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/"
SUBSCRIPTION_KEY = "00000000000000000000000000" SUBSCRIPTION_KEY = None
# Add your Bing Search V7 subscription key to your environment variables. # Add your Bing Search V7 subscription key to your environment variables.
#SUBSCRIPTION_KEY = os.environ['BING_SEARCH_V7_SUBSCRIPTION_KEY'] #SUBSCRIPTION_KEY = os.environ['BING_SEARCH_V7_SUBSCRIPTION_KEY']

Просмотреть файл

@ -12,7 +12,7 @@ sys.path.insert(0, current_dir)
# Add your Bing Search V7 subscription key to your environment variables. # Add your Bing Search V7 subscription key to your environment variables.
#SUBSCRIPTION_KEY = os.environ['BING_SEARCH_V7_SUBSCRIPTION_KEY'] #SUBSCRIPTION_KEY = os.environ['BING_SEARCH_V7_SUBSCRIPTION_KEY']
#ENDPOINT = os.environ['BING_SEARCH_V7_ENDPOINT'] #ENDPOINT = os.environ['BING_SEARCH_V7_ENDPOINT']
SUBSCRIPTION_KEY = "00000000000000000000000000" SUBSCRIPTION_KEY = None
# Comment this logging mute out, if you want to include logging # Comment this logging mute out, if you want to include logging
#logger = logging.getLogger() # get the default logger #logger = logging.getLogger() # get the default logger