This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Weather info yr.no new API
#3
You can override default user agent like this. This example uses LM MAC address to create a unique number for the user agent string.
Code:
json = require('json')
http = require('socket.http')
url = 'https://api.met.no/weatherapi/locationforecast/2.0/complete?lat=67.8596&lon=35.0904&altitude=13'
mac = 0
io.readfile('/sys/class/net/eth0/address'):gsub('%x%x', function(v)
  mac = mac * 256 + tonumber(v, 16)
end)
http.USERAGENT = 'LM ' .. mac
res, err = http.request(url)
log(res, err)
Reply


Messages In This Thread
Weather info yr.no new API - by AlexLV - 27.07.2020, 19:10
RE: Weather info yr.no new API - by admin - 28.07.2020, 07:10
RE: Weather info yr.no new API - by AlexLV - 28.07.2020, 11:17

Forum Jump: