Requests Flashcards

1
Q

Request

Post

A
data = {'example': 'json'}
headers = {'User-Agent': 'Chrome'}
requests.post(url, data=data, headers=headers)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Requests

Get

A

requests.get(url, headers=headers)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Requests

Get Status

A

response.status_code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Requests

Convert Response to Json

A

data = response.json()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Requests

Get amount of time from response

A

response.elapsed.total_seconds()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Requests

Get html or text of response

A

response.text

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Requests

Get a specific header

A

response.headers['HeaderName']

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Requests

Good Numeric values to API test

A

-1, 0, long number, fractions, 2 decimals points, string instead of int, missing variable, wrong method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly