Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to use/acess django rest api in python console application

I am new to Python and Django frameworks. I have Rest API’s developed using Django framework, how to access Rest API’s and display response in Python Console application?

Thanks

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

If you want to go all the way you need a http client in python, A popular one is requests

to use this in terminal you can just do

import requests
response = requests.get('http://localhost/api/myview')
print(response.status_code)
print(response.text)
print(response.json)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading