You can even use a nice Python dict to supply the query string in a GET request with params=. Res = requests.post(url, data=payload, headers=headers) You can see the docs (linked above) for details of setting all the options, since I imagine OP has moved on by now, and you - the reader now - likely need different ones.īut, for example, it's as simple as: url = '' That's it, really! You then have the raw res.text, or res.json() output, the res.headers, etc. It works, but is there a better way? Yes, there is a better way! Requests: HTTP for Humans
Python's supposed to be about flying! Anyone writing that is probably wishing they just call'd curl! But it hardly looks very Pythonic, does it? That's a lot of work just for one little request. That's crazy, there's got to be a better way right? So what you're asking is 'how do I run this other program, from within my program, just to make a measly little web request?'. This seeming like a good idea probably stems from a fairly wide misconception that shell commands such as curl are anything other than programs themselves. WoWDL is a website that allows you to download many files from the World of Warcraft game. But if something's worth doing, it's worth doing right, right? Download the Client WoW 2.4.3 Mac FR quickly and free with WoWDL. I know, that's the 'answer' nobody wants.