#!/usr/bin/python # encoding:utf-8 import urllib2, json, urllib from poster.encode import multipart_encode from poster.streaminghttp import register_openers # 1、银行卡识别 data = {} data["appkey"] = "your_appkey_here" register_openers() datagen, headers = multipart_encode({"pic": open("11.jpg", "rb")}) url_values = urllib.urlencode(data) url = "https://api.jisuapi.com/bankcardcognition/recognize" + "?" + url_values request = urllib2.Request(url,datagen, headers) result = urllib2.urlopen(request) jsonarr = json.loads(result.read()) if jsonarr["status"] != u"0": print jsonarr["msg"] exit() result = jsonarr["result"] for v in result: print v,result[v]