37,720
社区成员
发帖
与我相关
我的任务
分享
def rank_us(asin,site):
...
url = "https://www.amazon.com/dp/" + asin
try:
req=requests.get(url,headers=headers)
req.encoding='utf-8'
html=req.text
except requests.exceptions.ConnectionError:
print("retry line the internet...")
rank_us(asin,site)
html_x = etree.HTML(html)
def rank_us(asin,site):
...
url = "https://www.amazon.com/dp/" + asin
try:
req=requests.get(url,headers=headers)
req.encoding='utf-8'
html=req.text
except requests.exceptions.ConnectionError:
print("retry line the internet...")
rank_us(asin,site)
try:
html_x = etree.HTML(html)
except Exception as e:
print("出错啦 ")
print(repr(e))
def rank_us(asin,site):
...
url = "https://www.amazon.com/dp/" + asin
ret_flag = False
try:
req=requests.get(url,headers=headers)
req.encoding='utf-8'
html=req.text
ret_flag = True
except Exception as e :
print("出错啦 ")
print(repr(e))
rank_us(asin,site)
if ret_flag:
html_x = etree.HTML(html)
def rank_us(asin,site):
...
url = "https://www.amazon.com/dp/" + asin
ret_flag = False
try:
req=requests.get(url,headers=headers)
req.encoding='utf-8'
html=req.text
ret_flag = True
except requests.exceptions.ConnectionError:
print("retry line the internet...")
rank_us(asin,site)
if ret_flag:
html_x = etree.HTML(html)