1
때때로 API를 긁어 모으기 요청을 보내면 제대로로드되지 않고 가격 대신 -1
을 반환합니다.스킨 방법 중복을 반복하는 방법
그래서 while 루프를 사용하여 -1
을 얻는 한 요청을 반복하지만 반복 요청으로 인해 첫 번째 요청 후에 스파이더가 멈 춥니 다.
제 질문은 어떻게 중복 요청을 처리하도록 변경할 수 있습니까?
예제 코드 : 마음에
is_checked = False
while(not is_checked):
response = yield scrapy.Request("https://api.bookscouter.com/v3/prices/sell/"+isbn+".json")
jsonresponse = loads(response.body)
sellPrice = jsonresponse['data']['Prices'][0]['Price']
if sellPrice!=-1:
is_checked = True
yield {'SellPrice': sellPrice}
베어 나는 인라인 요청 라이브러리를 사용하지만 솔루션 관련이 없습니다.