Hello everyone,
What is the easiest way to get the content of a https webpage in pd, for example this one: https://tgftp.nws.noaa.gov/data/observations/metar/stations/CYDA.TXT Is there any patch that can do this around?
It doesn't seem to work when using [httpget] wrapper based on [mrpeach/tcpclient] changed to connect on port 443 instead of 80: tcpclient: recv: Connection reset by peer (54)
Thanks in advance! Best, n
On Wed, 2019-05-22 at 13:55 +0200, Nicolas Montgermont wrote:
Hello everyone,
What is the easiest way to get the content of a https webpage in pd, for example this one: https://tgftp.nws.noaa.gov/data/observations/metar/stations/CYDA.TXT Is there any patch that can do this around?
It doesn't seem to work when using [httpget] wrapper based on [mrpeach/tcpclient] changed to connect on port 443 instead of 80: tcpclient: recv: Connection reset by peer (54)
You could actually hack proper a HTTP request with Pd vanilla (you wouldn't even need [mrpeach/tcpclient], [netsend -b] would probably suffice), but doing everything through TLS makes things much more complicated.
I'd rather go with something that implements TLS natively, like purest_json.
For instance:
[declare -path purest_json]
[sslcheck 0, GET https://tgftp.nws.noaa.gov/data/observations/metar/stations/CYDA.TXT ( | [rest]
returns a symbol containing data from above URL. You may use some [list fromsymbol] trickery to do actually something useful with the data.
Roman
Roman Haefeli wrote:
On Wed, 2019-05-22 at 13:55 +0200, Nicolas Montgermont wrote:
Hello everyone,
What is the easiest way to get the content of a https webpage in pd, for example this one: https://tgftp.nws.noaa.gov/data/observations/metar/stations/CYDA.TXT Is there any patch that can do this around?
also consider using those objects that command line executions:
WINDOWS: [system] (in the "motex" library) LINUX & OSX: [shell] (in the "ggee" library)
you can get them via deken ("Help/Find Externals")
since those objecs are very basic and the syntax can be tricky (PD doesn't allow backslashes for example) my way of using them is to compose/write the command i would type into a shell/terminal into a text file, save it, and then call it from within PD using above objects.
(backslashes or other special characters can be emulated with [list tosymbol], if that fails consider using [binfile] from "mrpeach")
with this method you can pretty much do anything inside a PD patch that you would be doing in a terminal.
best
oliver
On Wed, 2019-05-22 at 15:26 +0200, oliver wrote:
Roman Haefeli wrote:
On Wed, 2019-05-22 at 13:55 +0200, Nicolas Montgermont wrote:
Hello everyone,
What is the easiest way to get the content of a https webpage in pd, for example this one:
https://tgftp.nws.noaa.gov/data/observations/metar/stations/CYDA.TXT
Is there any patch that can do this around?
also consider using those objects that command line executions:
WINDOWS: [system] (in the "motex" library) LINUX & OSX: [shell] (in the "ggee" library)
you can get them via deken ("Help/Find Externals")
since those objecs are very basic and the syntax can be tricky (PD doesn't allow backslashes for example) my way of using them is to compose/write the command i would type into a shell/terminal into a text file, save it, and then call it from within PD using above objects.
(backslashes or other special characters can be emulated with [list tosymbol], if that fails consider using [binfile] from "mrpeach")
with this method you can pretty much do anything inside a PD patch that you would be doing in a terminal.
Yes, you can, but it is not portable (as it requires different solutions depending on platform) and requires additional filesystem interactions. Using [shell] (or [system] for that matter) has all kinds of side effects, like [shell] searches scripts relative to Pd start location instead of relative to Pd patch. I wouldn't recommend using those.
Roman
WINDOWS: [system] (in the "motex" library) LINUX & OSX: [shell] (in the "ggee" library)
Yes, you can, but it is not portable (as it requires different solutions depending on platform) and requires additional filesystem interactions. Using [shell] (or [system] for that matter) has all kinds of side effects, like [shell] searches scripts relative to Pd start location instead of relative to Pd patch. I wouldn't recommend using those
you are right, it's more like a workaround/hack in case nothing else works. and it involves some tweaking, that's true.
for the purpose of http-downloading, one would also need a 3rd party commandline program like "wget" (at least for windows, as it's not native).
anyway, i just thought i'd add this method to the suggestions.
best
oliver
On Wed, May 22, 2019 at 10:03 AM oliver oliver@klingt.org wrote:
WINDOWS: [system] (in the "motex" library) LINUX & OSX: [shell] (in the "ggee" library)
Yes, you can, but it is not portable (as it requires different solutions depending on platform) and requires additional filesystem interactions. Using [shell] (or [system] for that matter) has all kinds of side effects, like [shell] searches scripts relative to Pd start location instead of relative to Pd patch. I wouldn't recommend using those
you are right, it's more like a workaround/hack in case nothing else works. and it involves some tweaking, that's true.
for the purpose of http-downloading, one would also need a 3rd party commandline program like "wget" (at least for windows, as it's not native).
I was looking into making a [httpsget] external but the whole TLS thing seems very difficult. For my purposes on linux I use [shell] with wget to save the data to a file, then open it with [binfile]. I was wondering if there is some cross-platform library to do the ssh, as I'm sure implementing it from scratch would take forever and be very error-prone. Not to mention doing it using vanilla objects....
Martin
On Wed, 2019-05-22 at 10:22 -0400, Martin Peach wrote:
On Wed, May 22, 2019 at 10:03 AM oliver oliver@klingt.org wrote:
WINDOWS: [system] (in the "motex" library) LINUX & OSX: [shell] (in the "ggee" library)
Yes, you can, but it is not portable (as it requires different solutions depending on platform) and requires additional
filesystem
interactions. Using [shell] (or [system] for that matter) has all
kinds
of side effects, like [shell] searches scripts relative to Pd
start
location instead of relative to Pd patch. I wouldn't recommend
using
those
you are right, it's more like a workaround/hack in case nothing else works. and it involves some tweaking, that's true.
for the purpose of http-downloading, one would also need a 3rd party commandline program like "wget" (at least for windows, as it's not native).
I was looking into making a [httpsget] external but the whole TLS thing seems very difficult. For my purposes on linux I use [shell] with wget to save the data to a file, then open it with [binfile]. I was wondering if there is some cross-platform library to do the ssh
I guess you mean SSL/TLS
, as I'm sure implementing it from scratch would take forever and be very error-prone. Not to mention doing it using vanilla objects....
I don't see why someone would have to do the work, it's already done:
♥♥♥ purest_json ♥♥♥
It does proper TLS and is cross-platform. Deken has binaries for Windows-i386 and they work, I just tested it (on Wine).
Roman
On Wed, May 22, 2019 at 11:27 AM Roman Haefeli reduzent@gmail.com wrote:
On Wed, 2019-05-22 at 10:22 -0400, Martin Peach wrote:
I was looking into making a [httpsget] external but the whole TLS thing seems very difficult. For my purposes on linux I use [shell] with wget to save the data to a file, then open it with [binfile]. I was wondering if there is some cross-platform library to do the ssh
I guess you mean SSL/TLS
Yes.
, as I'm sure implementing it from scratch would take forever and be
very error-prone. Not to mention doing it using vanilla objects....
I don't see why someone would have to do the work, it's already done:
♥♥♥ purest_json ♥♥♥
It does proper TLS and is cross-platform. Deken has binaries for Windows-i386 and they work, I just tested it (on Wine).
...but deken does not have it for 64bit Windows it seems. I never seem to have the right installation ;( Looking at the git ( https://github.com/residuum/PuRestJson/blob/master/Makefile) there sem to be a lot of libraries involved. The makefile has:
define forWindows
ldlibs += -lpthread -lm -lwldap32 -lgnutls -lhogweed -lgmp -lssl -lnettle
-lssh2 -lgcrypt -lgpg-error -lcrypto -lws2_32 -lgdi32 -lcrypt32
-lz -lunistring -lidn -lintl -liconv
It does look easier to just use Python for that stuff and let Pd do what it's good at.
Martin
On 5/22/19 9:59 PM, Martin Peach wrote:
...but deken does not have it for 64bit Windows it seems. I never seem to have the right installation ;(
well. Pd on W64 is *relatively* new. the last purest_json upload is from 2017, which was before Pd on W64 was a thing. thomas is usually quite responsive if you nag him about things, and he might just do an upload for W64 if you ask politely. (afaict, the latest changes were exactly about making purest_json buildable for W64; it seems only a release/upload is missing)
Looking at the git ( https://github.com/residuum/PuRestJson/blob/master/Makefile) there sem to be a lot of libraries involved. The makefile has:
define forWindows ldlibs += -lpthread -lm -lwldap32 -lgnutls -lhogweed -lgmp -lssl -lnettle
-lssh2 -lgcrypt -lgpg-error -lcrypto -lws2_32 -lgdi32 -lcrypt32
-lz -lunistring -lidn -lintl -liconv
well, encryption is not for the faint-hearted. just imagine (re)implementing all the things those library kindly provide. and that's before we even think of heartbleed and friends.
apart from that, purest-json does more things than just "ssl/tls", so it's probably a bit bloated if you are just interested in https.
It does look easier to just use Python for that stuff and let Pd do what it's good at.
sure. to be fair to purest_json, in order to provide the functionality, python also comes with quite a lot of dependencies (many more than purest_json). you won't notice, because you "just install" python and then they are there. but if you install the "purest_json" deken package, you shouldn't notice either.
also, from an integration perspective, it's probably easier to just run a single Pd process and do everything from there, rather than having to make sure all the various applications are starting up automatically. (otoh, doing http requests from within Pd will probably give you plenty of audio hickups).
mgfdsar IOhannes
Thanks roman,
This is working perfectly! best n
Le 22/05/2019 à 14:50, Roman Haefeli a écrit :
[sslcheck 0, GET https://tgftp.nws.noaa.gov/data/observations/metar/stations/CYDA.TXT (