Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.6k stars 2.81k forks source link

AZURE Cognitive Serivces -> KeyError: 'Endpoint' #9521

Closed andcald1982 closed 4 years ago

andcald1982 commented 4 years ago

I am using the SDK (Python) for Computer Vision published in Mocrosoft Docs (https://docs.microsoft.com/es-es/azure/cognitive-services/computer-vision/quickstarts-sdk/python-sdk).

When I run the code, this error occurs:

Traceback (most recent call last):

File "c:/analyze_image_local.py", line 68, in

description_result = computervision_client.describe_image_in_stream(local_image)

File "C:\Anaconda3\lib\site-packages\azure\cognitiveservices\vision\computervision\operations_computer_vision_client_operations.py", line 1202, in describe_image_in_stream

request = self._client.post(url, query_parameters, header_parameters, body_content)

File "C:\Anaconda3\lib\site-packages\msrest\service_client.py", line 193, in post

request = self._request('POST', url, params, headers, content, form_content)

File "C:\Anaconda3\lib\site-packages\msrest\service_client.py", line 108, in _request

request = ClientRequest(method, self.format_url(url))

File "C:\Anaconda3\lib\site-packages\msrest\service_client.py", line 155, in format_url

base = self.config.base_url.format(**kwargs).rstrip('/')

KeyError: 'Endpoint'

ghost commented 4 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dfulcer

ChrisHMSFT commented 4 years ago

Hi @andcald1982 ,

What is the structure of the endpoint you are using? It should match the one you can find in the Azure Portal in the QuickStart blade for the computer vision resource. If it is a newly deployed resource it will look like the following format: https://{resource name}.cognitiveservices.azure.com/

thanks, Chris

ChrisHMSFT commented 4 years ago

Hi @andcald1982 ,

Closing the ticket since we didn't hear back from you. Please re-open the ticket if you are still experiencing an issue.

Thanks! Chris

abhishakvarshney commented 4 years ago

Hi @ChrisHMSFT I am facing the same issue when using python-SDK. I am using the same Endpoint structure as mentioned above but It is giving me same error Key Error: 'Endpoint'. Kindly help me with that.

ChrisHMSFT commented 4 years ago

Hi @abhishakvarshney ,

are you using the computer vision SDK? If so, could you share which version?

Thanks,

Chris

abhishakvarshney commented 4 years ago

Hey @ChrisHMSFT Thanks for helping me out. I resolved the issue somehow. I am verifying two images but it's accuracy is quite low on using sdk/API while on website same files are giving me better accuracy(around double). Can you help me how can I improve this accuracy to dashboard/website level?

ChrisHMSFT commented 4 years ago

Hey @abhishakvarshney

This looks like a separate issue than the key error reported in this issue. can you please open a separate issue with details on what you are seeing.

thanks, Chris

alexcombessie commented 4 years ago

Hi,

I had a similar issue (exact same error message). It turned out that my endpoint URL had a small typo.

It would be great if you could improve the error handling with some URL validation and a clearer error message.

Have a good weekend,

Alex

Vinci141 commented 4 years ago

Hey , I got similar problem . the solution i applied is using below code( no quotes) cog_key = YOUR_COG_KEY cog_endpoint = YOUR_COG_ENDPOINT

It is possible your code is having quotes somewhere which is preventing to locate to the right direction. Hope this helps.