简体   繁体   中英

Google Apps Script UrlFetchApp returned 302 error and undefined response

I've tried to scrape and parse JSON data. While the below URL returns JSON data on browser, below code will generate an error by Google saying "Exception: Request failed for https://rate.tmall.com/list_detail_rate.htm returned code 302". Also, response is valued at undefined and I could not track anything from the response.

How can I solve the issue? Thanks a lot.

var response = UrlFetchApp.fetch("https://rate.tmall.com/list_detail_rate.htm");

I think I got it. I need to bring the cookies in the header. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM