jeudi 25 mai 2023

Is this an antipattern? [closed]

I'm building a streamlit app that connects to some third-party service, therefore you need to provide an API key to use it. My current approach is like this:

if os.environ['api_key']:
  def main_component():
    ...
  main_component()
else:
  def api_key_form():
    #get api key from form and store in os.environ
  api_key_form()


Is this a antipattern or unusual but fine?

Aucun commentaire:

Enregistrer un commentaire