Web API data to Pure Data Via Python as programmed by ChatGPT

Here is a method of getting data from a web API , into Pure Data, so the data can be used to control audio.

The API used here is open weather


first off heres the conversation i had with the big brain…..

it got the program straight off with this prompt, tho i didn’t specify to osc to output the data, but it used anyway (probably as i have used it before). I have also specified before that the program outputs in text whats it is doing whilst running, so thats why it prints comments when it does something (handy for bug finding). I didnt even spell the prompt right!

chat gpt also explains the code, and lets me know where to put in my API key and location of the city i want the data for.

i then take this code and run it in IDLE (a python code compiler) and make a very quick and simple patch in Pure Data to open an OSC channel localy on port 9000, and to route out the messages for temperature, hummidity and weather description.

heres the code

the python code

the pure data code

and it works!