fhem, freifunk, impfee, matemat: use open-uri properly

This commit is contained in:
Astro 2023-09-05 23:21:34 +02:00
parent 4801d49c7a
commit d93045ab74
4 changed files with 6 additions and 6 deletions

View File

@ -10,7 +10,7 @@ PASSWORD = ARGV[2]
points = []
doc = Nokogiri::HTML open("https://#{HOST}/fhem?room=all", :http_basic_authentication => [USER, PASSWORD])
doc = Nokogiri::HTML URI::open("https://#{HOST}/fhem?room=all", :http_basic_authentication => [USER, PASSWORD])
doc.css('.roomoverview tr').each do |row|
name = row.css('.col1').text
current = row.css('.col2').text

View File

@ -7,7 +7,7 @@ require 'influxdb'
HOST = ARGV[0]
data = JSON.parse open("http://#{HOST}/sysinfo-json.cgi").read()
data = JSON.parse URI::open("http://#{HOST}/sysinfo-json.cgi").read()
$node_id = data['data']['common']['node']
$node_name = URI::decode(data['data']['contact']['name'])

View File

@ -5,13 +5,13 @@ require 'json'
require 'influxdb'
# https://www.countee.ch/app/de/counter/impfee/_iz_sachsen
data = JSON.parse open("https://www.startupuniverse.ch/api/1.1/de/counters/getAll/_iz_sachsen").read()
data = JSON.parse URI::open("https://www.startupuniverse.ch/api/1.1/de/counters/getAll/_iz_sachsen").read()
points = []
data['response']['data'].each do |id, iz|
next if iz['closed'] != 0
sum = iz['counteritems'].map { |item| item['val'] }.sum
points.push({
series: "iz",
tags: {

View File

@ -10,13 +10,13 @@ PASSWORD = ARGV[2]
points = []
data = JSON.parse open("https://#{HOST}/statistics.json", :http_basic_authentication => [USER, PASSWORD]).read()
data = JSON.parse URI::open("https://#{HOST}/statistics.json", :http_basic_authentication => [USER, PASSWORD]).read()
points.push({
series: 'statistics',
values: data.map { |(n, i)| [n, i.to_i] },
})
data = JSON.parse open("http://#{HOST}/summary.json", :http_basic_authentication => [USER, PASSWORD]).read()
data = JSON.parse URI::open("https://#{HOST}/summary.json", :http_basic_authentication => [USER, PASSWORD]).read()
data.each do |d|
points.push({
series: 'summary',