Python 为InstaPy库中已分配的同类创建异常

Python 为InstaPy库中已分配的同类创建异常,python,instagram,except,instapy,Python,Instagram,Except,Instapy,我有下面的算法,通过URL对instagram照片执行喜欢和评论,我的目标是在5分钟内在AWS机器上运行此脚本,每天将生成288条评论。但是,每当他意识到自己已经像照片中那样执行时,他就会返回“喜欢的0个图像”|已经喜欢的:1“,并中止该过程。我想在LIKE已经存在的情况下创建一个交易,只需执行评论,是否可能?如果是,您可以帮助我提供示例或相关解决方案,谢谢 from instapy import InstaPy from instapy import smart_run def connec

我有下面的算法,通过URL对instagram照片执行喜欢和评论,我的目标是在5分钟内在AWS机器上运行此脚本,每天将生成288条评论。但是,每当他意识到自己已经像照片中那样执行时,他就会返回
“喜欢的0个图像”|已经喜欢的:1“
,并中止该过程。我想在LIKE已经存在的情况下创建一个交易,只需执行评论,是否可能?如果是,您可以帮助我提供示例或相关解决方案,谢谢

from instapy import InstaPy
from instapy import smart_run

def connect(insta_username,insta_password):

    try:

        session = InstaPy(username=insta_username,
                        password=insta_password,
                        headless_browser=False)

        return session

    except Exception as e:
        print("[FAILED] Caused by: {}".format(e))

def action(url,insta_username,insta_password):

    session = connect(insta_username,insta_password)

    try:

        with smart_run(session):

            # Always follow and like before, the algorithm understands how it has already been executed when used in place of the like function
            # Define interaction settings
            session.set_do_comment(enabled=True, percentage=100)
            session.set_comments(["@user-id"])
            session.set_user_interact(amount=1, randomize=False, percentage=100, media='Photo')

            # Start the feature
            session.interact_by_URL(urls=url, randomize=False, interact=True)
            session.end()

    except Exception as e:
        print("[FAILED] Caused by: {}".format(e))

if __name__ == "__main__":
    pics = ["https://www.instagram.com/p/id-here"]
    for url in pics:
        action(url,'username','password')