Dear Hamilton Community, are there possibilities ...
# hamilton-help
r
Dear Hamilton Community, are there possibilities to savely handle login credentials? I need to fetch files from a server that needs login details. I tried getpass.getpass() to write my password to the hamilton config. Later the password showed up in a log file. That is of course not an option for production. Maybe this is out of scope of hamilton and good solutions exit that i am not aware of. Again, any hints are appreciated
đź‘€ 1
s
@Richard Schulz which log file are you referring to? The Hamilton UI? or? If you are passing in a string, for example, to not “expose it”. You’d want to wrap it in a simple object. That way if someone prints/logs it, it wont be shown.
Copy code
class MySecret():
  
   def __init__(self, value):
      self.value = value

   def __repr__(self):
      return "[MySecret=******]"

m = MySecret(getpass.getpass())

db_client = db_credentials(..., m.value)
r
That is an option to start with. I am talking about the stdout from a local execution. I havent looked into the UI yet.
s
🤔 hmm I don’t recall us having a log statement that prints config by default.
Do you mind sharing part of the log line so I can see where it might be coming from?
r
********************************************************************************
image_loader [img_preparation_dag.image_loader()] encountered an error <
Node inputs:
{'image_loader.select_data.pipeline_config': "{'sharepoint_base_url': " "'https://viega.sharepoint....", 'img_url': "'Freigegebene%20Dokumente/General/050_Prozessf%C3%...", 'password_shrpt': 'notmypassword', 'username_shrpt': 'richard.schulz@somemail.com'} ********************************************************************************
This is the output i get if the node with the password passed to it fails.
s
Ah in the error stack trace
makes sense
yes the object trick above should work here
👍 1