I want to save images from vk's groups posts. But requests give me this mistake
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='sun1-95.userapi.com', port=443): Max retries exceeded with url: /impg/DKsod3pGDta5b1qODuCmR1u_wiTvWWO33PzrjA/m43mpFGA5qA.jpg?size=510x629&quality=95&sign=364cbe4ad52971f2f26e3f89919aba83&c_uniq_tag=L1vm9aX43cGpZQk5gSG60gH2874jU-KM4sTaPyEiEwQ&type=album (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001F647F59E90>, 'Connection to sun1-95.userapi.com timed out. (connect timeout=None)'))
I tried to fix it using the following code
connect_loop = True
while connect_loop:
try:
res = requests.get(url, timeout=3)
connect_loop = False
except requests.exceptions.RequestException: # любая ошибка requests
print('ConnectionError')
continue
After few minutes working, I get lots of