-3

I'm a newbie in using API. I just want to get the data from API and store it in a database. I know there are many libraries/packages in python to extract the data from specific API (for example Google API: google-api-python-client). So is there any generic library to get the data from API?

Thank you

  • 1
    It depends on the format of the data. If it's a RESTful JSON API, you can use `requests` to get the data, and `json` to convert it to a Python `dict` – clubby789 Oct 09 '19 at 10:41
  • I have read the second point multiple times. Can you please reword it? I am not able to understand your model. – WinningAddicted Oct 09 '19 at 10:41
  • Agreed @WinningAddicted - I can't understand the second point in the OP... – rst-2cv Oct 09 '19 at 10:48
  • @WinningAddicted It's my bad. I didn't have a proper understanding of what Redirect URL is. I've edited my question. Thanks – Nihal Mudhiraj Oct 09 '19 at 10:52
  • @NihalMudhiraj Good to know :) If there are no mode doubts, can you please close the question? – WinningAddicted Oct 09 '19 at 10:54
  • @ResetACK It's my bad. I didn't have a proper understanding of what Redirect URL is. I've edited my question. Thanks – Nihal Mudhiraj Oct 09 '19 at 11:03
  • @NihalMudhiraj it's not necessarily a bad thing to have asked a duplicate question, but we try to limit them as much as possible on StackOverflow to ensure high quality questions (and hopefully high quality answers) get the attention and recognition they deserve. Just something to think about for future questions you may ask :) – rst-2cv Oct 09 '19 at 11:05
  • @ResetACK The reply was for the earlier comment you made regarding the redirect url – Nihal Mudhiraj Oct 09 '19 at 11:08
  • Ah. No worries. – rst-2cv Oct 09 '19 at 11:12
  • @tehhowch This question is not restricted to a specific type of API and specifically asks for a generic library. How is it a duplicate of a question on how to use one specific API? – Joachim Wagner Oct 09 '19 at 11:19
  • @JoachimWagner given the OP accepted the answer below (which refers specifically to RESTful APIs), it stands to reason that it is a duplicate. – rst-2cv Oct 09 '19 at 11:20

1 Answers1

0

When you are trying to use a generic API service, inherently that means you want a library that can help you do the following:

(Assuming they are RESTful APIs):

  1. POST requests
  2. GET requests
  3. PUT requests

All you need is the requests module that fits the bill: https://pypi.org/project/requests/

Tutorial to use it: https://www.w3schools.com/python/module_requests.asp

For the second part, I am confused about what you exactly want to do. Do you want anyone to view some data if the have the URL to it? I can update my answer based on your inputs.

WinningAddicted
  • 471
  • 4
  • 7