Passing the secret scope to the url
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 09:29 AM
We are trying to call an URL by using the credentials,
we are able to get the data when we hard code the credentials.
Not returning any data when we pass the secret scope credentials.
below is the code.
import requests
source_db_scope = "dev-hnd-secret-scope"
source_user_name_secret = "username"
source_password_secret = "password"
username = dbutils.secrets.get(scope = source_db_scope, key = source_user_name_secret)
password = dbutils.secrets.get(scope = source_db_scope, key = source_password_secret)
url = "http://abc.com:8000/scheduler_etl.xsjs"
response = requests.get(url,auth=(username ,password ))
Can you please suggest. Appreciate your help
Thanks
Srini
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 09:41 AM
please try to debug what secret scope is returning. The ugly way to do it is:
for letter in username:
print(letter, ' ')
My blog: https://databrickster.medium.com/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 09:44 AM
Secret scope masks the value and returns [Redacted] for both username and password.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 09:46 AM
try
for letter in username:
print(letter, end=" "')
print("\n")
My blog: https://databrickster.medium.com/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 09:59 AM
I'm able to print the credentials and they are correct.