import requests
import datetime
from datetime import date, timedelta
# Hardcoded currencies, to be changed

def main():
	today = datetime.date.today()strftime("%Y%m%d")
	return get_csv(today)

def get_csv(date):
	headers = {
	'Host': 'calendar.fxstreet.com',
	'Connection': 'keep-alive',
	'Pragma': 'no-cache',
	'Cache-Control': 'no-cache',
	'Upgrade-Insecure-Requests': '1',
	'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36',
	'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
	'Referer': 'http://www.fxstreet.com/economic-calendar',
	'Accept-Encoding': 'gzip, deflate, sdch, br',
	'Accept-Language': 'en-US,en;q=0.8,zh-TW;q=0.6'
	}
	url = "https://calendar.fxstreet.com/eventdate/?f=csv&v=2&timezone=UTC&rows=&view=range&start=20160916&end=20160916&countrycode=AU%2CCA%2CCN%2CEMU%2CFR%2CDE%2CGR%2CIT%2CJP%2CNZ%2CPT%2CES%2CCH%2CUK%2CUS&volatility=0&culture=en&columns=CountryCurrency%2CCountdown" 
	csv_data = requests.get(url, headers=headers)
	csv_encode = csv_data.text.encode('utf-8')
	
	with open('event_calendar_today.csv', 'w') as csv_file:
		for row in csv_encode.split('/r/n'):
			csv_file.write(row)

	return csv_data

if __name__ == "__main__":
	main()

@@ -143,16 +143,17 @@
 .today()
+.
 strftime
@@ -199,16 +199,22 @@
 get_csv(
+input_
 date):%0A%09
@@ -843,29 +843,19 @@
 art=
-20160916&end=20160916
+%7B0%7D&end=%7B1%7D
 &cou
@@ -997,17 +997,47 @@
 untdown%22
- 
+.format(input_date, input_date)
 %0A%09csv_da

add input for today's date in fxstreet_scraper