Hello is it possible to open a file from google cloud storage and write to it?
request = requests.get(f'https://api.sportsdata.io/v3/nba/scores/json/TeamSeasonStats/2022?key=')
nba_team_stats = request.json()
# Cloud Storage (Connect to Cloud Storage)
data_file = open('nba_team_stats.csv', 'w')
csv_writer = csv.writer(data_file)
count = 0
for stats in nba_team_stats:
if count == 0:
header = stats.keys()
csv_writer.writerow(header)
count += 1
csv_writer.writerow(stats.values())
data_file.close()
this is my code that opens and writes and file in my local machine however how can I do the same thing with cloud function and cloud storage?