<commit_before><commit_msg>first commit<commit_after>#!/usr/bin/python

import sys
from suds import null, WebFault
from suds.client import Client
import logging
import json
import urllib2
import random


username = 'tamori'
apiKey = '<KEY>'
url = 'http://flightxml.flightaware.com/soap/FlightXML2/wsdl'

def flightaware(IATACode):
	username = 'tamori'
	apiKey = '<KEY>'
	url = 'http://flightxml.flightaware.com/soap/FlightXML2/wsdl'

	#http://iatacodes.org/api/v2/airports?code=CDG
	url_iata = "http://iatacodes.org/api/v2/airports?api_key=dbe3515a-5702-4ab2-a979-3033e2114d58&code="+IATACode
	print url
	#try:
	r = urllib2.urlopen(url_iata)
	root = json.loads(r.read())
	print 'icao=' + root['response'][0]['icao']
	#except:
	#	print "error"
	icao = root['response'][0]['icao']
	
	logging.basicConfig(level=logging.INFO)
	api = Client(url, username=username, password=apiKey)
	#print api
	
	# Get the weather
	#result = api.service.Metar('KAUS')
	#print result
	
	# Get the flights enroute
	result = api.service.Scheduled(icao, 20, '', 40)
	#print result
	flights = result['scheduled'][random.randint(0,10)]
	jsontxt = '{ "ident":"%s", "aircrafttype":"%s", "filed_departuretime":%d, "estimatedarrivaltime":%d, "origin":"%s", "destination":"%s", "originName":"%s", "originCity":"%s", "destinationName":"%s", "destinationCity":"%s"}' % (flights['ident'],flights['aircrafttype'],flights['filed_departuretime'],flights['estimatedarrivaltime'],flights['origin'],flights['destination'],flights['originName'],flights['originCity'],flights['destinationName'],flights['destinationCity'])
	print jsontxt
	return jsontxt


	#print "Aircraft en route to KSMO:"
	#for flight in flights:
	#    print "%s (%s) \t%s (%s)" % ( flight['ident'], flight['aircrafttype'],
	#                                  flight['originName'], flight['origin'])

flightaware('SFO')
{'fraction_non_alphanumeric': 0.18354087709799674, 'fraction_numerical': 0.02057390362750406, 'mean_word_length': 5.947368421052632, 'pattern_counts': {'":': 10, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2602270', 'n_tokens_mistral': 704, 'n_tokens_neox': 668, 'n_words': 115}