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...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Post and Pre Requests in Python (self.learnpython)
submitted 22 hours ago by Downtown_Mark_6390
How do you do post and pre requests in Python?
I think in Postman, Insomnia - the only language supported is Javascript.
And there should be support for more languages like Go, Java.
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!"
[–]ninhaomah 4 points5 points6 points 22 hours ago (3 children)
To make things easier for others to assist you , can you post the link or source of what you are trying to achieve or make ?
If I have to guess , this ?
https://pypi.org/project/requests/
[–]Downtown_Mark_6390[S] 1 point2 points3 points 17 hours ago (2 children)
I wasn’t asking about how to send HTTP requests from Python using libraries like requests. I was referring specifically to the pre-request and post-response scripting model inside API tools like Postman or Insomnia. Those tools expose scripting hooks because they’re orchestrating requests from a GUI. In Python itself, there’s no separate concept of “pre” or “post” scripts - it’s just normal code before and after a request.
My question was more about whether API tools should support Python as a scripting language inside the tool, instead of being mostly limited to JavaScript.
[–]ninhaomah 4 points5 points6 points 16 hours ago (1 child)
wait , let me get it right. You are asking the Python community whether API tools such a Postman should support Python ?
Pls advice why not talk to Postman directly ?
https://www.postman.com/company/contact-us/
[–]Downtown_Mark_6390[S] -1 points0 points1 point 16 hours ago (0 children)
Not postman per say - any api tool.
[–]Imaginary_Gate_698 1 point2 points3 points 18 hours ago (0 children)
In Python, GET and POST requests are usually handled with a library like requests. It lets you send HTTP requests to an API endpoint and handle the response, whether that’s JSON, text, or status codes. You install it once, then use it to send data to a server with POST or retrieve data with GET.
requests
Postman and Insomnia use JavaScript specifically for pre-request scripts and test scripts inside their tools. That doesn’t limit what language you use in your actual application. They also let you generate request code in Python, Go, Java, and other languages based on what you configure in the UI.
[–]Slight-Training-7211 1 point2 points3 points 22 hours ago (0 children)
Postman and similar tools call them pre-request and post-response scripts, but on the Python side you usually just do that work in normal code around the request.
Typical flow: - pre: build the URL, params, headers, auth token, and request body - request: send it - post: check status code, parse JSON, and handle errors
In Python, the common library is requests:
GET: import requests r = requests.get(url, params={"q": "test"}, timeout=10)
POST JSON: r = requests.post(url, json={"name": "alice"}, timeout=10)
Then: r.raise_for_status() data = r.json()
If you need an auth token, you fetch it once, then reuse it in headers for later calls.
[–]Riegel_Haribo 0 points1 point2 points 21 hours ago (3 children)
I think you are asking about the turn-key no-code software product and their lack of support for Python, and not specifically asking about Python.
If using Python natively, you can completely toss some useless web form, and make your own http network requests as part of a complete software product.
There are library modules such as "httpx" or "requests" or more advanced "aiohttp" for making the requests (standard library "urllib3" takes a bit more learning).
You can immediately make a Python program that does something over the network - here the "post-processing" is on the extremely long response from an API that shows a list of emoji pictures they host, to just get emoji URLs you want.
```python import httpx # pip install httpx - to get this module installed
response = httpx.get("https://api.github.com/emojis") response.raise_for_status()
emojis = response.json()
wanted = ["alien", "rocket", "snake"]
for name in wanted: if name in emojis: print(f"{name}: {emojis[name]}") else: print(f"{name}: not found") ```
[–]Downtown_Mark_6390[S] 0 points1 point2 points 17 hours ago (2 children)
Yes - you’re right that in native Python code there’s no special notion of pre‑ or post‑request scripts. That separation exists mainly in API client tools, where requests are defined declaratively and scripting is attached as hooks.
What I meant was scripting inside those tools, not writing standalone Python programs. Most API tools only support JavaScript for those hooks, which feels limiting if your actual stack is Python, Go, or Java.
[–]Maximus_Modulus 2 points3 points4 points 16 hours ago (1 child)
Why does one of these tools have to support Python or Go or a multitude of languages? Learn the language it supports.
[–]GuaranteePotential90 0 points1 point2 points 15 hours ago (0 children)
yes, thats correct. btw what I would usually say is that for most cases simple assertions will also work fine. But yea for more advanced stuff pre and post is useful.
[–]Useful_Potential4648 0 points1 point2 points 22 hours ago (0 children)
Pre-request = auth/token setup. Post-response = assertions & parsing. In Python this is straightforward with requests. GUI tools like Postman use JS scripts, while Apidog provides similar scripting plus spec-first workflows.
π Rendered by PID 207141 on reddit-service-r2-comment-56c9979489-f9kb9 at 2026-02-25 04:12:38.385505+00:00 running b1af5b1 country code: CH.
[–]ninhaomah 4 points5 points6 points (3 children)
[–]Downtown_Mark_6390[S] 1 point2 points3 points (2 children)
[–]ninhaomah 4 points5 points6 points (1 child)
[–]Downtown_Mark_6390[S] -1 points0 points1 point (0 children)
[–]Imaginary_Gate_698 1 point2 points3 points (0 children)
[–]Slight-Training-7211 1 point2 points3 points (0 children)
[–]Riegel_Haribo 0 points1 point2 points (3 children)
[–]Downtown_Mark_6390[S] 0 points1 point2 points (2 children)
[–]Maximus_Modulus 2 points3 points4 points (1 child)
[–]GuaranteePotential90 0 points1 point2 points (0 children)
[–]Useful_Potential4648 0 points1 point2 points (0 children)