<commit_before>import requests
import re
import json

r = requests.get('https://boka.snalltaget.se/boka-biljett')
cookie = r.cookies["Token"]
cookies = dict(Token=cookie)

query = json.loads('{"DepartureLocationId":1,"DepartureLocationProducerCode":74,"ArrivalLocationId":110,"ArrivalLocationProducerCode":74,"DepartureDateTime":"2014-02-21 12:00","TravelType":"E","Passengers":[{"PassengerCategory":"VU"}]}')

headers = {'content-type': 'application/json'}

r = requests.post('https://boka.snalltaget.se/api/timetables', data=json.dumps(query), headers=headers, cookies=cookies)

trips = r.json()

query = {'TimetableId':trips['Id'], 'JourneyConnectionReferences':[]}

if len(trips['JourneyAdvices']) > 10:
	max = 10
else:
	max = len(trips['JourneyAdvices'])

for i in range(0, max):
   query['JourneyConnectionReferences'].append(trips['JourneyAdvices'][i]['JourneyConnectionReference'])


r = requests.post('https://boka.snalltaget.se/api/journeyadvices/lowestprices', data=json.dumps(query), headers=headers, cookies=cookies)

price = r.json()

for i in range(0, len(trips['JourneyAdvices'])):
	for j in range (0,len(price)):
		if price[j]['JourneyConnectionReference'] == trips['JourneyAdvices'][i]['JourneyConnectionReference']:
			trips['JourneyAdvices'][i]['IsSleeperTrain'] = price[j]['IsSleeperTrain']
			trips['JourneyAdvices'][i]['LowestTotalPrice'] = price[j]['LowestTotalPrice']
			trips['JourneyAdvices'][i]['Currency'] = price[j]['Currency']
			break

print json.dumps(trips)
   <commit_msg>update url<commit_after>import requests
import re
import json
import tornado.ioloop
import tornado.web

class MainHandler(tornado.web.RequestHandler):
    def get(self):
		r = requests.get('https://boka.snalltaget.se/boka-biljett')
		cookie = r.cookies["Token"]
		cookies = dict(Token=cookie)

		query = json.loads('{"DepartureLocationId":1,"DepartureLocationProducerCode":74,"ArrivalLocationId":110,"ArrivalLocationProducerCode":74,"DepartureDateTime":"2014-02-21 12:00","TravelType":"E","Passengers":[{"PassengerCategory":"VU"}]}')

		headers = {'content-type': 'application/json'}

		r = requests.post('https://boka.snalltaget.se/api/timetables', data=json.dumps(query), headers=headers, cookies=cookies)

		trips = r.json()

		query = {'TimetableId':trips['Id'], 'JourneyConnectionReferences':[]}

		if len(trips['JourneyAdvices']) > 10:
			max = 10
		else:
			max = len(trips['JourneyAdvices'])

		for i in range(0, max):
		   query['JourneyConnectionReferences'].append(trips['JourneyAdvices'][i]['JourneyConnectionReference'])


		r = requests.post('https://boka.snalltaget.se/api/journeyadvices/lowestprices', data=json.dumps(query), headers=headers, cookies=cookies)

		price = r.json()

		for i in range(0, len(trips['JourneyAdvices'])):
			for j in range (0,len(price)):
				if price[j]['JourneyConnectionReference'] == trips['JourneyAdvices'][i]['JourneyConnectionReference']:
					trips['JourneyAdvices'][i]['IsSleeperTrain'] = price[j]['IsSleeperTrain']
					trips['JourneyAdvices'][i]['LowestTotalPrice'] = price[j]['LowestTotalPrice']
					trips['JourneyAdvices'][i]['Currency'] = price[j]['Currency']
					break
		self.write(trips)

application = tornado.web.Application([
    (r"/snalltaget/", MainHandler),
])

application.listen(8888)
tornado.ioloop.IOLoop.instance().start()
{'fraction_non_alphanumeric': 0.1823137492428831, 'fraction_numerical': 0.01756511205330103, 'mean_word_length': 7.2781954887218046, 'pattern_counts': {'":': 16, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5139885', 'n_tokens_mistral': 1260, 'n_tokens_neox': 1155, 'n_words': 156}