Requests Tutorial
Selected Reading
- Requests - Discussion
- Requests - Useful Resources
- Requests - Quick Guide
- Requests - Web Scraping using Requests
- Requests - Proxy
- Requests - Event Hooks
- Requests - Authentication
- Requests - SSL Certification
- Requests - Handling Sessions
- Requests - Handling History
- Requests - Handling Redirection
- Requests - Handling Timeouts
- Requests - Working with Errors
- Requests - Working with Cookies
- Requests - File Upload
- Handling POST, PUT, PATCH & DELETE Requests
- Requests - Handling GET Requests
- Requests - HTTP Requests Headers
- Handling Response for HTTP Requests
- Requests - Working with Requests
- Requests - How Http Requests Work?
- Requests - Environment Setup
- Requests - Overview
- Requests - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Requests - Working with Cookies
Requests - Working with Cookies
This chapter will discuss how to deal with cookies. You can get the cookies as well as send your cookies while calpng the URL using the requests pbrary.
The url,
when hits in the browser we can get the details of the cookies as shown below −You can read the cookies as shown below −
Example
import requests getdata = requests.get() print(getdata.cookies["__cfduid"])
Output
E:prequests>python makeRequest.py d1733467caa1e3431fb7f768fa79ed3741575094848
You can also send cookies when we make a request.
Example
import requests cookies = dict(test= test123 ) getdata = requests.get(,cookies=cookies) print(getdata.text)
Output
E:prequests>python makeRequest.py { "cookies": { "test": "test123" } }Advertisements