代理错误HTTPSConnectionPool(主机='i.instagram.com',端口=443)

问题描述 投票:0回答:1

请告诉我,我最近开始掌握这个库 - instagrapi。我发布了故事和rils几天,一切都很好,之后开始出现错误。我从一开始就使用代理,一切正常,但现在不行了。我已经尝试了很多付费代理,但没有任何帮助。

instagrapi.exceptions.ClientConnectionError:ProxyError HTTPSConnectionPool(host ='i.instagram.com',port = 443):超过最大重试次数,网址:/api/v1/launcher/sync/(由ProxyError('无法连接到代理)引起.', TimeoutError(10060, '尝试建立连接失败,因为在要求的时间内未从另一台计算机收到所需的响应,或者由于已连接的计算机的错误响应而终止了已建立的连接' ,无,10060,无)))

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")
python proxy instagram instagram-api instagrapi
1个回答
0
投票

您的代理服务器没有响应,您需要换一个新的。您发布的错误消息表明了这一点:

ProxyError('Cannot connect to proxy.' ...
TimeoutError

超时证明代理要么运行速度太慢,要么根本没有响应。

© www.soinside.com 2019 - 2024. All rights reserved.