简体   繁体   中英

python requests.get() keep getting 401

The task I want to complete is very simple. To do a http get request using python. Below is the code I used:

url = 'http://www.costcobusinessdelivery.com/AjaxWarehouseBrowseLookupView?storeId=11301&catalogId=11701&langId=-1&parentGeoNode=10112'

requests.get(url)

Then I got:

<Response [401]>

I am new to python, can someone help? Thanks!

Update: Based on the comments. It seems the code is okay, but I do get the 401 response. I doubt my company's network has some restrictions? But I can access and get a valid response through a browser. Is there a way to bypass my company's firewall/proxy or whatever? Just to pretend that I am using a browser in python? Thanks again!

If your browser is accessing the web via a proxy server, look that up on your browser settings and use that in python.

r = requests.get(url, proxies={"http": " http://61.233.25.166:80 "})

your proxy server will have a different address.

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