Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- import requests
- import datetime
- import pendulum
- start = pendulum.datetime(2018, 1, 1)
- end = pendulum.today()
- period = pendulum.period(start, end)
- for dt in period.range('days'):
- dt.format('YYYY-MM-DD')
- break
- the_date = dt.format('YYYY-MM-DD')
- outfile = open('TEST_PENDULUM_' + str(the_date) + '.csv',"w",newline='')
- writer = csv.writer(outfile)
- writer.writerow(["Date"])
- req = requests.get('https://www.fantasylabs.com/api/lines/4/' + str(the_date) + '/startinggoalies')
- data = req.json()['GoalieMatchups']
- for teams in data:
- HomeTeam = teams['Properties']['EventDate']
- print(HomeTeam)
- writer.writerow([HomeTeam])
- outfile.close()
Add Comment
Please, Sign In to add comment