Please tell me, I have recently started to master this library - instagrapi. I posted stories and rils for a couple of days, everything was fine, after which an error began to appear. I used a proxy from the very beginning and everything worked, but now it doesn't. I have already tried a lot of paid proxies, nothing helps.
instagrapi.exceptions.ClientConnectionError: ProxyError HTTPSConnectionPool(host='i.instagram.com', port=443): Max retries exceeded with url: /api/v1/launcher/sync/ (Caused by ProxyError('Cannot connect to proxy.', TimeoutError(10060, 'The attempt to establish a connection was unsuccessful, because the desired response was not received from another computer in the required time, or an already established connection was terminated due to an incorrect response from an already connected computer', None, 10060, None)))
from instagrapi import Client
from instagrapi.types import Usertag, Location
import random
import config
import time
class LikePost:
def __init__(self, client):
self.cl = client
self.tags = ['arduino']
self.like_medias = []
def get_post_id(self):
medias = cl.hashtag_medias_recent(random.choice(self.tags),
amount=1)
media_dict = medias[0].dict()
return str(media_dict['id'])
def like_post(self, amount):
for i in range(amount):
random_post = self.get_post_id()
if random_post in self.like_medias:
pass
else:
self.cl.media_like(media_id=random_post)
self.like_medias.append(random_post)
random_daley = random.randint(20, 60)
time.sleep(random_daley)
class MadeContent:
def __init__(self, client):
self.cl = client
def made_post(self, image, text, users, post_location):
self.cl.photo_upload(
path=image,
caption=text,
usertags=users,
location=post_location,
extra_data={
"like_and_views_counts_disabled": False,
"disacled_comments": False
})
def made_photo_story(self, image):
self.cl.photo_upload_to_story(image)
def made_video_story(self, video):
self.cl.video_upload_to_story(video)
def made_reals(self, video_path, text, thumbnail_path):
self.cl.clip_upload(
video_path,
text,
thumbnail_path,
)
proxy_login = ""
proxy_password = ""
proxy_port = "154.30.136.183:8000"
proxy = f"http://{proxy_login}:{proxy_password}@{proxy_port}"
cl = Client()
cl.set_proxy(proxy)
cl.login(config.username, config.password)
content = MadeContent(cl)
content.made_photo_story(r"C:\Users\PREDATOR\develop\insta_bot\R7O8r.jpg")
Your proxy server is unresponsive, and you need to get a new one. This is indicated from the error message you posted:
The timeout proves that the proxy is either too slow to function, or is not responsive at all.