<commit_before>'''
Hit cocorah's website API for a listing of stations and add entries for anything
new found
'''

import urllib2
import sys
import psycopg2
MESOSITE = psycopg2.connect(database='mesosite', host='iemdb')
mcursor = MESOSITE.cursor()

state = sys.argv[1]

req = urllib2.Request( ("http://data.cocorahs.org/cocorahs/export/"
                        +"exportstations.aspx?State=%s&Format=CSV"
                        +"&country=usa") % (state,) )
data = urllib2.urlopen(req).readlines()

# Find current stations<commit_msg>set timeout on data request<commit_after>'''
Hit cocorah's website API for a listing of stations and add entries for anything
new found
'''

import urllib2
import sys
import psycopg2
MESOSITE = psycopg2.connect(database='mesosite', host='iemdb')
mcursor = MESOSITE.cursor()

state = sys.argv[1]

req = urllib2.Request( ("http://data.cocorahs.org/cocorahs/export/"
                        +"exportstations.aspx?State=%s&Format=CSV"
                        +"&country=usa") % (state,) )
data = urllib2.urlopen(req, timeout=30).readlines()

# Find current stations
{'fraction_non_alphanumeric': 0.13138686131386862, 'fraction_numerical': 0.012773722627737226, 'mean_word_length': 3.6483050847457625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '926935', 'n_tokens_mistral': 380, 'n_tokens_neox': 358, 'n_words': 86}