例如,我有以下URL:
http://web.ca.com/y/d.ASP?id=1
我想每次请求该URL时都需要更改ID。
如何通过Python做到这一点。
结果
http://web.ca.com/y/d.ASP?id=2
答案 0 :(得分:0)
您可以使用requests
。
import requests
for x in range(0,10): # Here you define the amount of tries you're going to check
r = requests.get('http://web.ca.com/y/d.ASP?id={}'.format(x)) # this would be the loop value
print(r.status_code) # this would be the http response code