Compare commits
6 Commits
2f8085109f
...
6a19ae637b
Author | SHA1 | Date | |
---|---|---|---|
6a19ae637b | |||
e767149802 | |||
df277f4548 | |||
3f0f292ded | |||
ec6f64dcea | |||
871d9abf98 |
12
init.sql
Normal file
12
init.sql
Normal file
@ -0,0 +1,12 @@
|
||||
create table if not exists training(
|
||||
id integer primary key,
|
||||
medium varchar(255) not null,
|
||||
uuid uuid not null,
|
||||
t timestamp with time zone not null,
|
||||
lat float not null,
|
||||
lon float not null,
|
||||
speed float not null,
|
||||
altitude float not null,
|
||||
distance float not null,
|
||||
kcal int not null
|
||||
);
|
15
main.py
15
main.py
@ -5,7 +5,20 @@ from sqlalchemy import create_engine
|
||||
|
||||
|
||||
config = configparser.ConfigParser().read('config.ini')
|
||||
db = create_engine(f"postgresql://{config['db']['username']}:{config['db']['password']}@{config['db']['host']}/{config['db']['database']}")
|
||||
db = create_engine(f"postgresql://{config['db'][1]}:{config['db'][2]}@{config['db'][0]}/{config['db'][3]}").connect()
|
||||
mail = IMAP4(host=config['mail'][0])
|
||||
|
||||
|
||||
|
||||
def init_database():
|
||||
with open('init.sql') as f:
|
||||
db.execute('\n'.join(f.readlines()))
|
||||
|
||||
|
||||
def get_gpx_files_from_mail():
|
||||
mail.login(config['mail'][1], config['mail'][2])
|
||||
|
||||
mail.logout()
|
||||
|
||||
|
||||
def main():
|
||||
|
Loading…
x
Reference in New Issue
Block a user