Is this something I run in a Python console?
That's correct. I know this command works in the GUI console - I've not tested it personally in python (and I'm not at a machine in which I could test it personally for the time being), but I see no reason it wouldn't behave in the same way.
On a related note, now I have a different problem, that's how do I specify the "wallet_path" (or "electrum_path" and other config_options arguments through a CURL request? On the command line I could just do -w /path and it specifies the wallet path. But I'm not quite sure how I am supposed to specify this in this (example) request:
I'm not 100% sure about this, but try the following:
curl --data-binary '{"jsonrpc":"2.0","id":"curltext","method":"getbalance","params":{"config_options":{"subcommand":"load_wallet", "wallet_path":"/path/to/wallet", "password":"pass"}}}' http://username:password@127.0.0.1:7777