Skip to content

Commit

Permalink
introducing os for the db path
Browse files Browse the repository at this point in the history
  • Loading branch information
astreknet committed Feb 14, 2024
1 parent b51aa45 commit 0264c19
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion portfolio.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/usr/bin/env python3

import os
import json
import sqlite3

Expand All @@ -20,6 +23,7 @@

import requests

db_file = os.path.expanduser('~/Documents/portfolio.db')

# Define a function to create or connect to the database
def create_or_connect_db(db_name):
Expand Down Expand Up @@ -70,7 +74,7 @@ def fetch_coin_prices(session, coin_codes):
return json.loads(response.text)

def main():
conn, cursor = create_or_connect_db('portfolio.db')
conn, cursor = create_or_connect_db(db_file)
all_coins = fetch_portfolio_data(cursor)
conn.close()

Expand Down

0 comments on commit 0264c19

Please sign in to comment.