requests post 파라미터 에러

조회수 578회

with requests.ssesion() as s: 문으로 로그인후 세션을 받아서 쿠키를 설정한 상태입니다. 다른 페이지(get, json) 출력은 잘 되는데요.
아래 페이지의 경우 post요청을 하면 에러가 납니다.
어디가 문젤까요?

url='https://www.esmplus.com/Sell/SingleGoodsMng/GetSingleGoodsList?_dc=1629816933189'
s.headers = {
    'Accept': '*/*',
    'Accept-Encoding': 'gzip, deflate, br',
    'Accept-Language': 'ko,en-US;q=0.9,en;q=0.8,fr;q=0.7',
    'Connection': 'keep-alive',
    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
    'Cookie':'_ga=GA1.2.1292533393.162***************************',
    'Host': 'www.esmplus.com',
    'Origin': 'https://www.esmplus.com',
    'Referer': 'https://www.esmplus.com/Sell/SingleGoodsMng?menuCode=TDM396',
    'sec-ch-ua': '"Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"',
    'sec-ch-ua-mobile': '?0',
    'Sec-Fetch-Dest': 'empty',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Site': 'same-origin',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36',
    'X-Requested-With': 'XMLHttpRequest'
}


data = {
    'paramsData':{
        "Keyword":"밸브",
        "SiteId":"1",
        "CategorySiteId":1,
        "CategoryCode":"641009",
        "CategoryLevel":"S",
        "TransPolicyNo":502170,
        "StatusCode":"",
        "SearchDateType":1,
        "SearchStartDate":"",
        "SearchEndDate":"",
        "SellerId":"rmfrmffla",
        "SellerSiteId":"1",
        "StockQty":10,
        "SellPeriod":15,
        "DiscountUseIs":1,
        "DeliveryFeeApplyType":2,
        "OptAddDeliveryType":1,
        "OptSelUseIs":2,
        "PremiumEnd":3,
        "PremiumPlusEnd":30,
        "FocusEnd":7,
        "FocusPlusEnd":30,
        "GoodsIdType":"S",
        "GoodsIds":"",
        "ShopCateReg":1,
        "IsTPLUse":"TL",
        "SellMinPrice":"",
        "SellMaxPrice":"",
        "OrderByType":11,
        "GroupOrderByType":1,
        "IsGroupUse":"Y",
        "IsApplyEpin":"1",
        "IsConvertSingleGoods":"N" },
    'page': 1,
    'start': 0,
    'limit': 20,
    'group' : [{"property":"SingleGoodsNo","direction":"ASC"}]
}

res =  s.post(url,data=data, headers = headeres).json()
print(res)

{'Result': None, 'ResultBase': {'ReturnErrorMessage': '잘못된 JSON 기본 형식: Keyword.', 'ReturnErrorCode': '999999', 'ReturnDomain': 'A', 'ActionCode': 'L'}, 'ExceptionMessage': '알수없는 에러가 발생 했습니다.'}

아래 추가로 이미지 첨부했습니다. 리퀘스트 헤더에 쿠키는 너무 길어서 화면이 잘렸습니다. 4번째 프리뷰 이미지에 보시면 json형식으로 데이터가 출력이 잘 됩니다.

이미지이미지이미지이미지

  • (•́ ✖ •̀)
    알 수 없는 사용자
  • headers 오타 확인 부탁드리고.. post 로 요청하면 reponse DOM에서 자바스크립트로 특정url 로 redirect 시키는거 같은데 그걸 파싱해서 접속하시거나 하시면 될거같아요 김호원 2021.8.26 12:03

1 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)