Accessing Private API in databricks notebook
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2023 07:38 AM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 10:35 PM
@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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2023 11:27 PM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2024 07:18 AM
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

