#compsci #python 

Requests is a simple [[HTTP]] library for Python

## Quickstart
Making a request:
```python
import rqeusts
r = requests.get('https://api.github.com/events")
r = requests.post("https://httpbin.org/post", data={'key':'value'})
r = requests.put("https://httpbin.org/put", data={'key':'value'})
r = requests.delete('https://httpbin.org/delete")
r = requests.head("https://httpbin.org/get")
r = requests.options("https://httpbin.org/get')
```
([[httpbin.org]] used)

Almost all of the most popular [[HTTP request methods]] are supported

Result is a **Response** object.
### Passing parameters in URLs
![[Pasted image 20250313103611.png]]

### Response Content
![[Pasted image 20250313103638.png]]
![[Pasted image 20250313103647.png]]

### [[JSON]] Response Content
![[Pasted image 20250313103912.png]]

### Raw Response Content
![[Pasted image 20250313104232.png]]

### Custom Headers
![[Pasted image 20250313104303.png]]

### More Complicated POST requests
![[Pasted image 20250313104848.png]]
![[Pasted image 20250313104900.png]]
![[Pasted image 20250313104927.png]]

### Response Status Codes
![[Pasted image 20250313105220.png]]
![[Pasted image 20250313105233.png]]

### Response Headers
![[Pasted image 20250313105252.png]]

### Cookies
![[Pasted image 20250313105311.png]]
![[Pasted image 20250313105320.png]]

### Redirection and History
![[Pasted image 20250313105414.png]]

### Timeouts
![[Pasted image 20250313105429.png]]


## Advanced usage

### Session Objects
![[Pasted image 20250313105910.png]]
![[Pasted image 20250313105927.png]]
![[Pasted image 20250313105950.png]]

### Request and Response objects

![[Pasted image 20250313105813.png]]

### Prepared Requests
![[Pasted image 20250313110046.png]]

### SSL Cert Verification
![[Pasted image 20250313110120.png]]

### Client Side Certificates
![[Pasted image 20250313110139.png]]

### Proxies
![[Pasted image 20250313110215.png]]
### [[SOCKS]]
![[Pasted image 20250313110249.png]]
### Custom HTTP verbs
![[Pasted image 20250313110334.png]]

## Authentication
### Basic Authentication
![[Pasted image 20250313110407.png]]
### Digest Authentication
![[Pasted image 20250313110447.png]]
