Azure-docs: Missing slash in url path

Created on 28 Jan 2020  Â·  8Comments  Â·  Source: MicrosoftDocs/azure-docs

The sample shown in the Computer Vision quickstart for REST in Python is missing a slash. I was getting errors without it. I then added it in, and it worked great.

https://docs.microsoft.com/en-us/azure/cognitive-services/computer-vision/quickstarts/python-analyze

Here is where I added it in: analyze_url = endpoint + "/vision/v2.1/analyze"

It was the forward slash before the word vision. The quickstart is missing that.

The error without it are here (amongst many other lines):

socket.gaierror: [Errno 11001] getaddrinfo failed
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='westus.api.cognitive.microsoft.comvision', port=443): Max retries exceeded with url: /v2.0/analyze?visualFeatures=Categories%2CDescription%2CColor (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x00000205B3A301C8>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 cognitive-servicesvc computer-visiosubsvc cxp doc-bug triaged

All 8 comments

@wiazur Thanks for the feedback. We are investigating the issue and will update you shortly.

@wiazur It looks like the variable COMPUTER_VISION_ENDPOINTwas not updated using the endpoint as seen in the Azure portal where the forward slash(/) is mentioned as part of endpoint URL. The general guidance is to use the endpoint details from the resource page which would not result in adding an extra / in analyze_url = endpoint + "vision/v2.1/analyze"
image

Thanks @RhohitMungi-MSFT, I'll let my manager know. The endpoints in Azure have not been consistent with their pattern of usage, so this might be a good thing to share with him. Oftentimes you only use what they call the base endpoint, which is http://<custom-name-or-region>.api.cognitive.microsoft.com. Then other times you are supposed to use the full endpoint path as shown in Azure. I'll pass this on, thanks again.

I am getting a similar error:
gaierror: [Errno -3] Temporary failure in name resolution

NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7f193b2d9048>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution

MaxRetryError: HTTPSConnectionPool(host='mike-test.cognitiveservices.azure.com', port=443): Max retries exceeded with url: /vision/v2.1/ocr/?language=en&detectOrientation=false (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f193b2d9048>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

ConnectionError: HTTPSConnectionPool(host='mike-test.cognitiveservices.azure.com', port=443): Max retries exceeded with url: /vision/v2.1/ocr/?language=en&detectOrientation=false (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f193b2d9048>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

This is the list errors when I execute:
response = requests.post(ocr_url, headers=headers, params=params, data=image_data)

@inthevortex thanks, what does your ocr_url look like? In the error, they don't show the http:// in the host url, I have also seen that problem before, where it's being truncated for some reason. If you add the http:// back in will that work? For example add it in, in the end of the URL process (right before the API call takes it) like this:

response = requests.post('http://' + ocr_url, headers=headers, params=params, data=image_data)

I have found the issue to be in the OS, I researched a bit and found that Windows and Mac OSX are having outdated openSSL versions installed by default which force the connection to be TLS 1.0 but the cognitive services API requires a minimum of TLS 1.2. So I tried it on a debian system and it worked like it should. I think the documentation should include this point.

I got to know that cognitive services accepts TLS 1.2 by analyzing the domain via ssllabs.

@inthevortex Great, thanks for sharing that. I'll forward this to our docs and service team.

Thanks, it will help out other who get stuck with this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bdcoder2 picture bdcoder2  Â·  3Comments

Ponant picture Ponant  Â·  3Comments

jharbieh picture jharbieh  Â·  3Comments

spottedmahn picture spottedmahn  Â·  3Comments

JeffLoo-ong picture JeffLoo-ong  Â·  3Comments