cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing Private API in databricks notebook

Laltu_singh
New Contributor II

Hello, I am trying to access an API in databricks python notebook which is available within a restricted network.

When I try to access that API, it's not able to find the URL used to access the API and throws an HTTP error (max retries exceeded).

do you have any suggestions on how to access the API for above case?

3 REPLIES 3

Anonymous
Not applicable

@Laltu Singh​ : To access an API in Databricks from within a restricted network, you may need to configure a proxy server to route your requests through like below.

import os
 
os.environ['HTTP_PROXY'] = 'http://<proxy_hostname>:<proxy_port>'
os.environ['HTTPS_PROXY'] = 'http://<proxy_hostname>:<proxy_port>'
os.environ['NO_PROXY'] = '<comma-separated-list-of-hostnames-or-IP-addresses>'

Replace <proxy_hostname> and <proxy_port> with the hostname and port of your proxy server, respectively. Replace <comma-separated-list-of-hostnames-or-IP-addresses> with a comma-separated list of hostnames or IP addresses that should not be routed through the proxy.

If you continue to experience issues accessing the API, it may be helpful to reach out to the network administrator for the restricted network to ensure that the necessary firewall rules are in place to allow traffic to and from the API endpoint.

Anonymous
Not applicable

Hi @Laltu Singh​ 

Hope everything is going great.

Just wanted to check in if you were able to resolve your issue. If yes, would you be happy to mark an answer as best so that other members can find the solution more quickly? If not, please tell us so we can help you. 

Cheers!

pjv
New Contributor III

Hi! 

Could you recommend a way to setup a proxy server that can reroute all HTTP traffic according to the above advice? Thank you!

Kind regards,

Pim

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group