GPYC Exam QuestionsBrowse all questions from this exam

GPYC Exam - Question 31


With a requests session object named `browser`, how can the expiration attribute of a cookie named `MUID` from `gpyc.com/` be accessed?

A.

B.

C.

D.

E.

Show Answer
Correct Answer:

To access the expiration attribute of a cookie named 'MUID' from 'gpyc.com/' using a requests session object named `browser`, the correct syntax would involve accessing nested dictionaries that represent the cookies. You would start by accessing the `cookies` attribute of the `browser` object. The nested dictionaries inside `cookies` are structured to first access the domain, then the path, and then the specific cookie name. Therefore, the correct way to access this attribute is: `browser.cookies._cookies['.gpyc.com']['/']['MUID'].expires`. Thus, the correct answer is B.

Discussion

1 comment
Sign in to comment
kyao
Apr 21, 2024

B is the right one.