Error connecting to an api and fetch data

Raj D 616 Reputation points
2021-09-08T17:47:05.67+00:00

Hi, I am running a notebook in Azure Synapse Analytics against an apache spark pool with pyspark code, where I am connecting to an api and view data in json. When I test this out in postman it works as expected. But when I run the notebook I get error.

Code:

import requests
user = 'name'
password = 'abc123'
response = requests.get('https:/webapi/getdata', auth=(user, password))
data = response.json()
print(data)

Error:

ConnectionError: HTTPSConnectionPool(host='', port=#): Max retries exceeded with url: (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fe70e4690f0>: Failed to establish a new connection: [Errno 110] Connection timed out',))
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,373 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Raj D 616 Reputation points
    2021-10-01T00:14:59.353+00:00

    Hi @PRADEEPCHEEKATLA There was some issue with the apache spark pool I created. I had to delete and create a new one. That resolved the issue.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.