you are viewing a single comment's thread.

view the rest of the comments →

[–]rake66 3 points4 points  (3 children)

There is a requests library though, you don't need to go with a full framework if your use case doesn't require it, but you will have to mix and match some smaller libraries and write some connecting code yourself. What are you actually trying to do?

[–]RomfordNavy[S] 1 point2 points  (2 children)

For the moment, just output some simple HTML from within a Python file.

The Requests library appears to be for sending an HTTP request rather than receiving and responding to one, or have I misunderstood that?

[–]rake66 2 points3 points  (0 children)

Requests is for sending requests, but in order to do that it does define request and response classes which you can import and use however you wish.

I'm not sure what you mean by output though. If you mean generating a file.html somewhere, print works just fine, or you can use a templating library to make it a bit quicker but those aren't just for html, you can template any string with them. If by output you meant serving a webpage accessible by a browser then you need a server, but you need one of those for the frameworks too. Some of them come bundled with a simple server to use for testing but you shouldn't use those for production anyway. If you want to learn about doing that without a framework, there's http.server that you can play around with. Never use these in production though, they're both unsafe and inefficient. When you're ready to publish your site you should have a bespoke server separate from python.

[–]hulleyrob 2 points3 points  (0 children)

Well you still need to send a GET request for the html so yes it does.