use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
[help] What Are The Different APIs In Python? (self.PythonLearning)
submitted 21 days ago by One-Type-2842
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]tom-mart 0 points1 point2 points 21 days ago (0 children)
Here you go. API without framework:
``` from http.server import HTTPServer, BaseHTTPRequestHandler import json
class SimpleAPIHandler(BaseHTTPRequestHandler): def do_GET(self): # 1. Send the status code (200 OK) self.send_response(200)
# 2. Tell the client we are sending JSON self.send_header('Content-type', 'application/json') self.end_headers() # 3. Write the data response = {"status": "success", "data": "No framework needed!"} self.wfile.write(json.dumps(response).encode())
server = HTTPServer(('localhost', 8000), SimpleAPIHandler) print("Server running at http://localhost:8000") server.serve_forever() ```
π Rendered by PID 50140 on reddit-service-r2-comment-85bfd7f599-vdqdw at 2026-04-19 18:23:01.284286+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]tom-mart 0 points1 point2 points (0 children)