WebDev Flashcards

1
Q

urllib modules

A

request: open URLs
response: (used internaly)
error: exceptions
parse: useful URL function

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

urllib request

A

resp = urllib.request.urlopen(‘url’)

or use context manager

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

urllib HTTPResponse methods and attributes

A

resp. code - status code
resp. lenght - response lenghts
resp. peek() - preview part of response
resp. read() - read response body as binary

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

urllib parse querystring

A

urllib.parse.urlencode(query_dict)

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