Because I can not get the cookies [closed]

-3
from http.cookiejar import *
from urllib.request import *
test = CookieJar()
abridor = build_opener(HTTPCookieProcessor(test))
abridor.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0')]
abridor.open("http://afr232elldh.elbruto.es")
print(test)

The goal is to obtain Cookies, from the link

page

What is the reason for not obtaining the data?

  

Answer: For security.

This answer does not work for me

    
asked by codigo_aqui 31.05.2017 в 01:11
source

1 answer

3

By definition, a web page has no status ... every time it is recharged, all its information is lost and all its values are reset. When a page needs to have a status, it is necessary to store certain information in the web browser ... this information is presented in the form of cookies, which are nothing more than small files that store variables indicated by the page.

The browser only allows you to read the cookies that belong to the domain of the page, why? for security and privacy.

  • For security: If all cookies were accessible by any page a malicious web would have too easy to recover the session data of your bank, which could even allow money transfers.
  • By privacy: Limiting access to cookies prevents a page from snooping on them looking for browsing histories. The latter with Google and its ubiquitous advertising loses some sense, but even so this policy limits your exposure in part.

Sorry if you do not like this kind of answers but it is what you get. You can always try to break the browser's protection systems to access third-party cookies, but then do not be surprised if the browser turns a patch to avoid that interference.

    
answered by 31.05.2017 в 10:11