13 lines
415 B
Python
Raw Normal View History

"""Authentication header encoding"""
import base64
from os import environ
app_id, app_key = environ.get('ASTRONOMY_API_APP_ID'), environ.get('ASTRONOMY_API_APP_SECRET')
userpass = f'{app_id}: {app_key}'
auth_string = base64.b64encode(userpass.encode()).decode()
auth_header = {'Authorization': f'Basic {auth_string}'}
app_id, app_key, userpass = None, None, None
if __name__ == '__main__':
print(auth_header)