0

I am new to Django. I need to use some API to get the .json format data. But the API needs authentication. I have already got the username and password. I see my colleague use Postman to enter the account then he can see the JSON file in intellij.

I am in Pycharm, I am wondering is there some code I can use to realize the same function of postman rather than install the postman? What I have: API URL, account username and password

Any help is really appreciated, also please let me know which file I should write in the Django, views.py??


Update: thank you for all the help!I am sorry I am not familiar with the postman, I only know my colleague show me how to enter the username and password.

I have the API/URL, when I click on it, it will direct me to a page with JSON format data, looks like this

{"businessOutcomes":[{"businessOutcomeId":"1234","origin":"JIRA",.....]}

I have over 100 this kind of URL/API, I want to get the .json file in pycharm and so I can make them as the df to do the data analysis I want. And my colleague told me that the API has some authentication and I have to use the username and password to get in.

I hope this explain what I want to realize.

5
  • I'm not 100% sure what you want to do but it is easy to create a REST API with json output using Django REST Framework. Commented Jun 28, 2023 at 17:37
  • use of PostMan is for Testing Purpose to check yours API is working fine or not. but as a final step you have to use it using requests module if you're calling it from python. or use of Ajax or Axios which are based on Javascript. the you have to include your creds as payload and then you will response based on your API. Commented Jun 28, 2023 at 17:38
  • If you are just looking to test the api, if you are using PyCharm professional, and an hour or so to learn: youtube.com/… Commented Jun 28, 2023 at 18:07
  • @AMG Hi AMG, thank you for the help. I am in the community version of Pycharm.....and I do some detailed info in the original question. Commented Jun 28, 2023 at 18:26
  • Get your json data into a response object, then read it with panda's read_json. See stackoverflow.com/a/46578150/4872140 for a sample. How you use the user/pass depends on the type of authentication. Here is one example: stackoverflow.com/a/65222521/4872140 Commented Jun 29, 2023 at 23:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.