Hi,
I'm sorry but the hurl stuff is way over my head. The following curl command on linux gives me the data that I need:
curl >weather.txt -X GET "https://api.weather.gov/stations/KBOI/o ... re_qc=true"
How do I do the same thing using hurl? Thanks much!
NathanH
Very NOOB hurl question
Re: Very NOOB hurl question
hURL is complicated to me too (:-))
but here seems that its a server idiom, that it does not return data without User-Agent header !! (that needed reverse chenking
but here seems that its a server idiom, that it does not return data without User-Agent header !! (that needed reverse chenking
Code: Select all
@REQUIRE "hurl"
Function p_WriteData(dataloc$)
DebugPrint(dataloc$)
EndFunction
url$ = "https://api.weather.gov/stations/KBOI/observations/latest?require_qc=true"
e = hurl.Easy({URL = url$, WriteFunction = p_WriteData})
e:setopt_http_version(#CURL_HTTP_VERSION_1_1)
e:setopt_httpheader({"User-Agent: NathanH Hollywood Script"})
e:perform()
Christos
Re: Very NOOB hurl question
You can use the high-level interface for easier access when you're just doing simple downloads.
To download as a file:
Or in a string variable for processing in Hollywood:
And yes, for some reason the default Hollywood user agent doesn't work for this server.
To download as a file:
Code: Select all
DownloadFile("https://api.weather.gov/stations/KBOI/observations/latest?require_qc=true", {File = "weather.txt", Adapter = "hurl", UserAgent="YetAnotherWeatherApp/1.0"})
Code: Select all
Local data$ = DownloadFile("https://api.weather.gov/stations/KBOI/observations/latest?require_qc=true", {Adapter = "hurl", UserAgent="YetAnotherWeatherApp/1.0"})
Re: Very NOOB hurl question
Thanks guys,
These all work just great! It seems the UserAgent option was the catch. I don't know enough to know that that could have been the problem. Thanks.
NathanH
These all work just great! It seems the UserAgent option was the catch. I don't know enough to know that that could have been the problem. Thanks.
NathanH