Exam GPYC All QuestionsBrowse all questions from this 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.

    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
kyao

B is the right one.