Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

731
Views
Solicitud Django x-www-form-urlencoded

Estoy tratando de hacer la siguiente solicitud con django: ingrese la descripción de la imagen aquí

Probé el siguiente código pero no funciona:

 data = {'username': admin, 'password': 123, 'grant_type': 'password', 'client_id': 'xxxx', 'client_secret': 'xxxx'} headers = {'content-type': 'application/x-www-form-urlencoded'} r = requests.post(url, data=data, headers=headers)

Gracias por tu ayuda !

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Está codificado por formulario de forma predeterminada.

Por lo general, desea enviar algunos datos codificados en formularios, como un formulario HTML. Para hacer esto, simplemente pase un diccionario al argumento de datos. Su diccionario de datos se codificará automáticamente cuando se realice la solicitud.

 >>> payload = {'key1': 'value1', 'key2': 'value2'} >>> r = requests.post("http://httpbin.org/post", data=payload) >>> print r.text { "origin": "179.13.100.4", "files": {}, "form": { "key2": "value2", "key1": "value1" }, "url": "http://httpbin.org/post", "args": {}, "headers": { "Content-Length": "23", "Accept-Encoding": "identity, deflate, compress, gzip", "Accept": "*/*", "User-Agent": "python-requests/0.8.0", "Host": "127.0.0.1:7077", "Content-Type": "application/x-www-form-urlencoded" }, "data": "" }

http://docs.python-requests.org/en/v0.10.7/user/quickstart/#make-a-post-request

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!