thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

DevOps & Automation · Foundational

Python Requests Library

The de facto Python HTTP client library for calling REST APIs.

Definition

requests provides get, post, put, patch, and delete functions with headers, params, json, auth, timeout, and verify arguments. Responses expose status_code, headers, text, and json(). raise_for_status() raises on 4xx/5xx.

Example

r = requests.get(url, headers={'X-Auth-Token': token}, timeout=10); r.json()

Exam tip

json= sends a JSON body and sets Content-Type; data= sends form-encoded data. Always set a timeout.

Related terms