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
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, ' ')
01-26-2023 09:44 AM
Secret scope masks the value and returns [Redacted] for both username and password.
01-26-2023 09:46 AM
try
for letter in username:
print(letter, end=" "')
print("\n")
01-26-2023 09:59 AM
I'm able to print the credentials and they are correct.
Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!
Sign Up Now