Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
How to consume Django Rest Framework with a simple python application

I need to make a python app to make a connection with the API

The python app is gonna send the user's ID to the API, then it's gonna get some informations about this user, such as their name, whether they are authenticated and so on.

I already know how to create the rest api, But I don't know how to consume it.

Thanks.

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use requests. Use it like this:

# Get 
resp = requests.get('https://api.github.com/user', auth=('user', 'pass'))
json_response = resp.json()
# Response: {u'private_gists': 419, u'total_private_repos': 77, ...}
is_authenticated = json_response.get('is_authenticated', False)
if is_authenticated == True:
   # Do stuff

# Post
r = requests.post('http://httpbin.org/post', data = {'key':'value'})
r.json()
# Similar response as above
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda