Getting session-info
The session() method returns the session object which provides certain parameters to manipulate the requests. It can also manipulate cookies for all the requests initiated from the session object. If a large amount of requests are made to a single host then, the associated TCP connection is recalled.
Python3
# Import Libraries import requests # Creating Session s = requests.Session() s.get( 'http://httpbin.org/cookies/set/sessioncookie/419735271' ) # Getting Response r = s.get( 'http://httpbin.org/cookies' ) # Show Response print (r.text) |
Output:
{ "cookies": { "sessioncookie": "419735271" } }
Network Programming Python – HTTP Clients
The request from the client in HTTP protocol reaches the server and fetches some data assuming it to be a valid request. This response from the server can be analyzed by using various methods provided by the requests module. Some of the ways below provide information about the response sent from the server to the Python program running on the client-side :
Contact Us