<commit_before>#!/usr/bin/env python

import requests
import string
import random  
import sys
import numpy as np

import socket
import time
now = int( time.time() )
lines =[]


reload(sys)
sys.setdefaultencoding('utf-8')


from BeautifulSoup import BeautifulSoup
from pynag.Plugins import PluginHelper,ok,warning,critical,unknown

url =  'http://www3.vegag.is/faerd/linurit/vedur.htm'
html = requests.get(url).content

winds = []
max_winds = []
average_wind = []
avg_temp = []
avg_temp_at_road = []
for i in html.split('\n'):
  soup = BeautifulSoup(i)
  a = soup.find('a')
  if not a:
    continue
 
  name = a.text
  attributes = i.split()
  if len(attributes) == 13:
    attributes.pop(0)
    attributes.pop(0)
    
    date = attributes.pop(0)
    time = attributes.pop(0)
    direction = attributes.pop(0)
    wind = attributes.pop(0)
    max_wind = attributes.pop(0)
    if max_wind == '(':
      max_wind = attributes.pop(0)
    max_wind = max_wind.strip(')').strip('(')
    temperature = attributes.pop(0)
    temperature_at_road = attributes.pop(0)
    humidity = attributes.pop(0)
    traffic_last_10_minutes = attributes.pop(0)
    traffic_today = attributes.pop(0)
    max_winds.append( max_wind )
    winds.append( wind)
    avg_temp.append(wind)
    avg_temp_at_road.append(temperature_at_road)

    name = name.replace(' ','_')
    print 'vegagerdin.%s.wind %s %d' % (name, wind.strip('%'), now) 
    print 'vegagerdin.%s.max_wind %s %d' % (name, max_wind.strip('%'), now) 
    print 'vegagerdin.%s.traffic_last_10_minutes %s %d' % (name, traffic_last_10_minutes, now) 
    print 'vegagerdin.%s.traffic_today %s %d' % (name, traffic_today, now) 
    print 'vegagerdin.%s.temperature %s %d' % (name, temperature_at_road, now) 
    print 'vegagerdin.%s.temperature_at_road %s %d' % (name, temperature_at_road, now) <commit_msg>Fix typo in vegagerdin graphite script<commit_after>#!/usr/bin/env python

import requests
import string
import random  
import sys
import numpy as np

import socket
import time
now = int( time.time() )
lines =[]


reload(sys)
sys.setdefaultencoding('utf-8')


from BeautifulSoup import BeautifulSoup
from pynag.Plugins import PluginHelper,ok,warning,critical,unknown

url =  'http://www3.vegag.is/faerd/linurit/vedur.htm'
html = requests.get(url).content

winds = []
max_winds = []
average_wind = []
avg_temp = []
avg_temp_at_road = []
for i in html.split('\n'):
  soup = BeautifulSoup(i)
  a = soup.find('a')
  if not a:
    continue
 
  name = a.text
  attributes = i.split()
  if len(attributes) == 13:
    attributes.pop(0)
    attributes.pop(0)
    
    date = attributes.pop(0)
    time = attributes.pop(0)
    direction = attributes.pop(0)
    wind = attributes.pop(0)
    max_wind = attributes.pop(0)
    if max_wind == '(':
      max_wind = attributes.pop(0)
    max_wind = max_wind.strip(')').strip('(')
    temperature = attributes.pop(0)
    temperature_at_road = attributes.pop(0)
    humidity = attributes.pop(0)
    traffic_last_10_minutes = attributes.pop(0)
    traffic_today = attributes.pop(0)
    max_winds.append( max_wind )
    winds.append( wind)
    avg_temp.append(wind)
    avg_temp_at_road.append(temperature_at_road)

    name = name.replace(' ','_')
    print 'vegagerdin.%s.wind %s %d' % (name, wind.strip('%'), now) 
    print 'vegagerdin.%s.max_wind %s %d' % (name, max_wind.strip('%'), now) 
    print 'vegagerdin.%s.traffic_last_10_minutes %s %d' % (name, traffic_last_10_minutes, now) 
    print 'vegagerdin.%s.traffic_today %s %d' % (name, traffic_today, now) 
    print 'vegagerdin.%s.temperature %s %d' % (name, temperature, now) 
    print 'vegagerdin.%s.temperature_at_road %s %d' % (name, temperature_at_road, now) 
{'fraction_non_alphanumeric': 0.14281850148769273, 'fraction_numerical': 0.012442520962942927, 'mean_word_length': 3.790155440414508, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '204911', 'n_tokens_mistral': 1427, 'n_tokens_neox': 1348, 'n_words': 281}