0
您好我有下面的代碼,但我得到一個錯誤的module object has no attribute HTTPSConnection
:「模塊」對象有沒有屬性「HTTPSConncetion」
from ecomstore import settings
import httplib
import urllib
def do_auth_capture(amount='0.00', card_num=None, exp_date=None, card_cvv=None):
delimiter = '|'
raw_params = {
'x_login':settings.AUTHNET_LOGIN,
'x_tran_key':settings.AUTHNET_KEY,
'x_type':'AUTH_CAPTURE',
'x_amount':amount,
'x_version':'3.1',
'x_card_num':card_num,
'x_exp_date':exp_date,
'x_delim_char':delimiter,
'x_relay_response':'FALSE',
'x_delim_data':'TRUE',
'x_card_code':card_cvv
}
params = urllib.urlencode(raw_params)
headers = {'content-type':'application/x-www-form-urlencoded',
'content-length':len(params)}
post_url = settings.AUTHNET_POST_URL
post_path = settings.AUTHNET_POST_PATH
cn = httplib.HTTPSConncetion(post_url,httplib.HTTPS_PORT)
cn.request('POST',post_path, params, headers)
return cn.getresponse().read().split(delimiter)
有沒有發生這種情況的一個原因?
哈哈該死的。我很盲目。 – locoboy 2012-01-08 19:33:52
@ cfarm54:帶我看了兩眼。 ;-) – Thanatos 2012-01-09 07:49:57