ビル:
from __future__ import print_function
import pycurl
try:
# python 3
from urllib.parse import urlencode
except ImportError:
# python 2
from urllib import urlencode
c = pycurl.Curl()
c.setopt(c.URL, 'https://mywebsite.com/pageA')
post_data = {'email': '[email protected]', 'pass': 'MyPass', 'submit': 'login'}
# Form data must be provided already urlencoded.
postfields = urlencode(post_data)
# Sets request method to POST,
# Content-Type header to application/x-www-form-urlencoded
# and data to send in request body.
c.setopt(c.POSTFIELDS, postfields)
c.setopt(c.COOKIEJAR, 'cookie.txt')
c.setopt(c.COOKIEFILE, 'cookie.txt')
try:
c.perform()
c.setopt(c.URL, 'https://mywebsite.com/pageB')
c.perform()
except pycurl.error as error:
errno, errstr = error
print('An error occurred: ', errstr)
c.close()
私はウェブで見つけ、このスクリプトを試してみました: http://codebin.it?s=57d5650ef0c1790003000001 が、それは – who