Skip to content

Commit

Permalink
Added requests package to the dependencies in Pipfile and Added Absol…
Browse files Browse the repository at this point in the history
…ute Path for Data file
  • Loading branch information
ruchita-nathani committed Nov 5, 2023
1 parent a92a7d3 commit e9975eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions BDC/src/data_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import csv
import requests
import json
import os


class DataCollector:
Expand All @@ -13,7 +14,8 @@ def __init__(self):
def get_data_from_csv():
"""Retrieve information from the CSV file and utilize it in the Google API"""
data = []
with open('../data/given_data.csv', 'r', encoding='utf8') as file:
file_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../data/given_data.csv')
with open(file_path, 'r', encoding='utf8') as file:
csv_reader = csv.reader(file)
next(csv_reader)

Expand All @@ -39,8 +41,8 @@ def get_data_from_api():

if response.status_code == 200:
data = response.json()

with open("../data/collected_data.json", "w") as json_file:
file_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../data/collected_data.json')
with open(file_path, "w") as json_file:
user_data = []
for users in data["users"]:
data_dict = {
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pytest = "==7.4.3"

[packages]
numpy = "==1.26.1"
requests = "*"

[requires]
python_version = "3.10"

0 comments on commit e9975eb

Please sign in to comment.