2014-05-11 4 views
0

지금은 Python 응용 프로그램에 OC Transpo API (http://www.octranspo1.com/developers/documentation)를 사용하고 있습니다. 내가 오류 오류가파이썬 요청시 curl에 -d가 사용됩니다.

sys.path.insert(0, 'modules') 
from octranspo import OcTranspoGetter 
import utilities 

octranspo = OcTranspoGetter(); 
soapData = octranspo.getLiveData('3017','94') 

print soapData.text 

: 자신의 API에 대한 내 요구를 들어

내가 가진 코드를 실행할 때이

class OcTranspoGetter: 
#import credentials from file, my credentials are not in sample file, 
#they can be gotten from http://www.octranspo1.com/developers/ 
def __init__(self): 
    credFile = open('../config/logins.ser') 
    credentials = pickle.load(credFile) 

    self.apiID = credentials['apiLogin']['apiID'] 
    #self.apiKey = credentials['apiLogin']['apiKey'] 
    self.payLoad = {'apiID':self.apiID,'apiKey':self.apiKey} 

    print self.payLoad 

#Get live data 
def getLiveData(self,bus,stop): 
    self.payLoad['stopNum'] = stop 
    soapData = requests.post('https://api.octranspo1.com/v1.2/GetRouteSummaryForStop',data = self.payLoad) 
    return soapData 

비록이 데이터를 검색 할 ID로 응용 프로그램 = "" 찾지 못했습니다

soapData에서 반환 된 url에서 request.post()가 API 요청시 get 메소드를 사용하고있는 것 같습니다. 이 서비스는 curl -d 명령을 사용하는 문서에 게시가 필요합니다. 내가 요청한 문서 (http://docs.python-requests.org/en/latest/user/quickstart)에서 내가하는 일은 게시물 요청을해야하지만, 그렇지 않습니다. 설명서에 누락 된 것이 있습니까?

답변

0

문서에 따르면 첫 번째 매개 변수는 appID이어야하며 사용자가 가지고있는대로 apiID이 아니어야합니다.

관련 문제