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 time
|
||||||
import zipfile
|
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/'
|
download_directory = quotes_directory + 'Zip Archive/'
|
||||||
|
|
||||||
def process_file(file: str):
|
def process_file(file: str):
|
||||||
@ -20,11 +25,11 @@ def download_quotes():
|
|||||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||||
client.connect(
|
client.connect(
|
||||||
hostname='sftp.datashop.livevol.com',
|
hostname='sftp.datashop.livevol.com',
|
||||||
username=os.environ['USER'],
|
username=getenv('USER'),
|
||||||
password=os.environ['PASSWORD']
|
password=getenv('PASSWORD')
|
||||||
)
|
)
|
||||||
sftp = client.open_sftp()
|
sftp = client.open_sftp()
|
||||||
sftp.chdir('./subscriptions/' + os.environ['ORDER'] + '/' + os.environ['ITEM'])
|
sftp.chdir('./subscriptions/' + getenv('ORDER') + '/' + getenv('ITEM'))
|
||||||
files = sftp.listdir()
|
files = sftp.listdir()
|
||||||
for file in files:
|
for file in files:
|
||||||
local_file = download_directory + file
|
local_file = download_directory + file
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
pandas
|
pandas
|
||||||
paramiko
|
paramiko
|
||||||
|
python-dotenv
|
||||||
pytz
|
pytz
|
||||||
schedule
|
schedule
|
Loading…
Reference in New Issue
Block a user