Switch to using dotenv module to retrieve environment variables
This commit is contained in:
parent
7a177b38c9
commit
f2b1bb8d2a
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.env
|
@ -5,7 +5,12 @@ import schedule
|
||||
import time
|
||||
import zipfile
|
||||
|
||||
quotes_directory = os.environ['DOWNLOAD_DIRECTORY']
|
||||
from dotenv import load_dotenv
|
||||
from os import getenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
quotes_directory = getenv('DOWNLOAD_DIRECTORY')
|
||||
download_directory = quotes_directory + 'Zip Archive/'
|
||||
|
||||
def process_file(file: str):
|
||||
@ -20,11 +25,11 @@ def download_quotes():
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
client.connect(
|
||||
hostname='sftp.datashop.livevol.com',
|
||||
username=os.environ['USER'],
|
||||
password=os.environ['PASSWORD']
|
||||
username=getenv('USER'),
|
||||
password=getenv('PASSWORD')
|
||||
)
|
||||
sftp = client.open_sftp()
|
||||
sftp.chdir('./subscriptions/' + os.environ['ORDER'] + '/' + os.environ['ITEM'])
|
||||
sftp.chdir('./subscriptions/' + getenv('ORDER') + '/' + getenv('ITEM'))
|
||||
files = sftp.listdir()
|
||||
for file in files:
|
||||
local_file = download_directory + file
|
||||
|
@ -1,4 +1,5 @@
|
||||
pandas
|
||||
paramiko
|
||||
python-dotenv
|
||||
pytz
|
||||
schedule
|
Loading…
Reference in New Issue
Block a user