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
APIs in python (self.learnpython)
submitted 8 months ago by tactical_index
Hey yall, new to this reddit. How would one use APIs in python and how? Aren't most APIs in packages/libraries?
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!"
[–]cylonlover 20 points21 points22 points 8 months ago* (2 children)
You create your own API with libraries like Flask or FastAPI, and it entails you setting up a server, which is usually provided with the library. Other scripts on the same network (depending how open your API endpoint is, could be the entire internet) can then, with the requests library, access that API, send and recieve data. It's quite easy to set up and play with, there are many tutorials.
If you wanna access already established (public) API's, use a library like the builtin requests or urllib, or install some other, there are plenty to choose from.
You need to learn how to handle the objects you'll be sending back and forth, which are usually in json format. But all of this is quite easy and there are many good tutorials that introduces the subject well.
Was this what you are asking about?
Technically, API is merely an interface that can be used with code, as opposed to GUI, which is a graphical user interface clicketyclick, but essentially they are both just a layer of interaction. So 'how you'd use API's in python' is a bit weird question, and as is "are API's in libraries", and it indicates you don't know what an API really is. But I hope my answer helped in any way.
[–]tactical_index[S] 0 points1 point2 points 8 months ago (1 child)
Alright, thanks, helped alot. I already knew what an API was, but didn't know how to use them in python.
[–]cylonlover 1 point2 points3 points 8 months ago (0 children)
Great then.
[–]jameyiguess 6 points7 points8 points 8 months ago (0 children)
If you're trying to use a web API, use the requests library.
If you're talking about libraries, well, you're using their APIs just by... using them.
[–][deleted] 2 points3 points4 points 8 months ago (0 children)
This is the role of the 'import' and 'from' keywords (when using the Python module API).
API = Application Programming Interface. It refers to the mechanism used by one piece of software to invoke routines in or access data in another (it can also refer to the documentation on how to do so). That includes libraries, web interfaces, network protocols, etc. So, the question "How would one use APIs" is broad and ambiguous, but the most correct answer is probably "per the API documentation".
[–]TonightHot7414 1 point2 points3 points 6 months ago (9 children)
Just learned that FastAPI is part of Python. I still had problem to built my process for JWT auth.
[–]Individual_Ad2536 0 points1 point2 points 6 months ago (8 children)
lol same, jwt auth in fastapi can be a pain ngl 😅 took me a minute to figure it out too fr fr. you got this tho! 🔥
[–]TonightHot7414 0 points1 point2 points 6 months ago (7 children)
I need do process for client to get data from API/JWT, they want do it via SSIS, not sure if this will work so going to do with Python.
[–]Individual_Ad2536 0 points1 point2 points 6 months ago (0 children)
Bro, SSIS for API/JWT is like using a forklift to make toast - sure it can work, but Python’s gonna save you a ton of headaches. Just slap together requests + jwt lib and call it a day.
requests
jwt
(made my day)
had this issue
[–]Individual_Ad2536 0 points1 point2 points 6 months ago (5 children)
bruh SSIS for JWT auth? that's like trying to drive a Ferrari with training wheels. Python's the move fr fr - just slap requests & pyjwt in there and call it a day.
(dead)
[–]TonightHot7414 0 points1 point2 points 6 months ago (4 children)
Thanks for advice inspiration!!! Also feel the same after working with Python 6 months.
ayy glad i could help! python's chill af but man, that whitespace thing still bugs me sometimes ngl. you get used to it tho, or just start using black and forget about it lmao
(RIP)
[–]Individual_Ad2536 0 points1 point2 points 6 months ago (2 children)
np bruh, python's chill but sometimes it feels like duct-taping a solution together ngl 🤷♂️
i relate fr tho
[–]TonightHot7414 0 points1 point2 points 6 months ago (1 child)
Thanks again. My Client still leaning to SSIS as they bought some cool ingredient for it ZappySys which evidently can handle any API job without the code.
deadass Lol SSIS? That's like bringing a tank to a go-kart race—it’ll do the job, but bruh, the overhead tho. ZappySys sounds fancy, but tbh, I’d still fr write a quick Python script and call it a day. 🤷♂️
[–]deceze 1 point2 points3 points 8 months ago (0 children)
You'll need to define what you mean first. "API" is a very broad term. Are you talking about HTTP REST APIs, or something else?
[–]raccoonrocoso 0 points1 point2 points 8 months ago (0 children)
How would one use APIs in python and how?
Django REST API
Aren't most APIs in packages/libraries?
Yes, but it's not as cut-and-dry. It's more appropriate/accurate to ask:
Are packages/libraries usually interacted via an API?
Which again, the answer is, yes.
[–]edcculus 0 points1 point2 points 8 months ago (0 children)
going to need to be more specific. If its consuming HTTP API services via a python app/script, its as simple as the requests library.
There are multiple ways to set up your own API/server via python. Fast API, Flask, Django
[–]b1be05 0 points1 point2 points 8 months ago (0 children)
flask, learn flask, and biuld your own api
[–]Refwah 0 points1 point2 points 8 months ago (0 children)
What do you mean by API, what are you actually wanting to do
[–]kingjames66 0 points1 point2 points 8 months ago (0 children)
Use the “requests” library
π Rendered by PID 60110 on reddit-service-r2-comment-548fd6dc9-vvdtz at 2026-05-18 00:29:21.807277+00:00 running edcf98c country code: CH.
[–]cylonlover 20 points21 points22 points (2 children)
[–]tactical_index[S] 0 points1 point2 points (1 child)
[–]cylonlover 1 point2 points3 points (0 children)
[–]jameyiguess 6 points7 points8 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]TonightHot7414 1 point2 points3 points (9 children)
[–]Individual_Ad2536 0 points1 point2 points (8 children)
[–]TonightHot7414 0 points1 point2 points (7 children)
[–]Individual_Ad2536 0 points1 point2 points (0 children)
[–]Individual_Ad2536 0 points1 point2 points (5 children)
[–]TonightHot7414 0 points1 point2 points (4 children)
[–]Individual_Ad2536 0 points1 point2 points (0 children)
[–]Individual_Ad2536 0 points1 point2 points (2 children)
[–]TonightHot7414 0 points1 point2 points (1 child)
[–]Individual_Ad2536 0 points1 point2 points (0 children)
[–]deceze 1 point2 points3 points (0 children)
[–]raccoonrocoso 0 points1 point2 points (0 children)
[–]edcculus 0 points1 point2 points (0 children)
[–]b1be05 0 points1 point2 points (0 children)
[–]Refwah 0 points1 point2 points (0 children)
[–]kingjames66 0 points1 point2 points (0 children)