O'Reilly logo

Python Requests Essentials by Bala Subrahmanyam Varanasi, Rakesh Vidya Chandra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Revealing the structure of a request and response

A Requests object is the one which is created by the user when he/she tries to interact with a web resource. It will be sent as a prepared request to the server and does contain some parameters which are optional. Let us have an eagle eye view on the parameters:

  • Method: This is the HTTP method to be used to interact with the web service. For example: GET, POST, PUT.
  • URL: The web address to which the request needs to be sent.
  • headers: A dictionary of headers to be sent in the request.
  • files: This can be used while dealing with the multipart upload. It's the dictionary of files, with key as file name and value as file object.
  • data: This is the body to be attached to the request.json. There are two cases ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required