Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python urllib2,网站称未启用Cookie_Python_Python 2.7_Cookies_Web Scraping_Urllib2 - Fatal编程技术网

Python urllib2,网站称未启用Cookie

Python urllib2,网站称未启用Cookie,python,python-2.7,cookies,web-scraping,urllib2,Python,Python 2.7,Cookies,Web Scraping,Urllib2,我正在尝试创建一个网站,但当我登录时,它显示cookies未启用,并限制访问。这是我的密码,有什么问题吗 import urllib2 import urllib from cookielib import CookieJar from BeautifulSoup import BeautifulSoup cj = CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) url = 'https:/

我正在尝试创建一个网站,但当我登录时,它显示cookies未启用,并限制访问。这是我的密码,有什么问题吗

import urllib2
import urllib
from cookielib import CookieJar
from BeautifulSoup import BeautifulSoup

cj = CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))

url = 'https://pamet-sapphire.k12system.com/CommunityWebPortal/Welcome.cfm'

# Prepare the data
query_args = { 'j_username':'username', 'j_password':'pass', 'j_pin':'pin' }

# This urlencodes your data (that's why we need to import urllib at the top)
data = urllib.urlencode(query_args)

# Send HTTP POST request

response = opener.open(url, data)
print cj 

print response.info()

html = response.read()

# Print the result
print html

您能用print r打印返回的响应并告诉我答案是什么吗?@user12321您所说的print r是什么意思?印刷答复如下: