Then, I could loop "data" like a list to access the API data. How could I do this in C++? So far, I've seen "file" (not URL) examples suggesting I need secondary software. Is there not a simpler way to do this on my IDE? To A) import a url and B) access the data? And should I use Json or XML when importing API data from a url in regards to C++? I found it easier with Python to use json but I'm suspecting in C++, XML might be better.
Do you need to do this in C++? libcurl (an HTTP client implementation) is not exactly a beginner-friendly library. Have you considered simply calling into C++ from Python using a foreign function call and then processing the data in C++?
The C++ std library does not provide networking support. There is a draft technical paper discussing a possible future networking library in the std library, but that's as far as it goes.
You're going to have to use a 3rd party library.
CURL is very popular and widespread, with lots of examples available.
I don't have to use C++ but I would really like too. My goal was to make this in both Python and C++, however I'm up for calling the data from Python if need be. I'll look into this foreign function call.
Are you looking at extending Python or embedding Python? Extending Python means to call functions in a different language from Python, while embedding Python means to call the Python interpreter as a library, from a different language.
What I'm suggesting is to use Python to download the content and then call into C++ (extending) to process it.
The examples in the Python documentation for extending will probably use C, but you can use C++, too. You just have to export the function you want to expose to Python as C functions.
1 2 3 4
extern"C"void this_is_a_function_callable_from_c(constchar *string){
std::string s = string;
std::cout << s << std::endl;
}
Seems confusing because there's numerous examples using 3rd party libraries (most notably boost). Is that required to simply extend a python function into C++?