subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.38k stars 685 forks source link

[BUG] Trying to tag users leads to Invalid Tagged Users error #759

Closed kaijif closed 2 years ago

kaijif commented 2 years ago

Describe the bug A clear and concise description of what the bug is. Trying to tag users within Client.photo_upload results in InvalidTag errors. To Reproduce Provide a piece of code to reproduce the problem.

from instagrapi import Client
from instagrapi.types import Usertag, UserShort
import random

client = Client()
client.login("usr", "pswd")
lidl = Usertag(x=10, y=10, user=UserShort(username="lidlus", pk="5310318684"))
peru = Usertag(x=20, y=20, user=UserShort(username="avosfromperu", pk="1382501091"))
tags = [lidl, peru]

client.photo_upload("path", "caption", usertags=tags)

Traceback Show your full traceback so that it is clear where exactly the error occurred.

Traceback (most recent call last):
  File "/Users/kaiji/PycharmProjects/avotesla/lib/python3.8/site-packages/instagrapi/mixins/private.py", line 298, in _send_private_request
    response.raise_for_status()
  File "/Users/kaiji/PycharmProjects/avotesla/lib/python3.8/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/media/configure/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/kaiji/PycharmProjects/avotesla/main.py", line 16, in <module>
    client.photo_upload(f"/Users/kaiji/PycharmProjects/avotesla/avocados/p{i}.jpeg", "Another delicious whole avocado... \r\n\r\n\r\n#LidlAvoTeslaSweepstakes @lidlus @avosfromperu", usertags=tags)
  File "/Users/kaiji/PycharmProjects/avotesla/lib/python3.8/site-packages/instagrapi/mixins/photo.py", line 234, in photo_upload
    if self.photo_configure(
  File "/Users/kaiji/PycharmProjects/avotesla/lib/python3.8/site-packages/instagrapi/mixins/photo.py", line 310, in photo_configure
    return self.private_request("media/configure/", self.with_default_data(data))
  File "/Users/kaiji/PycharmProjects/avotesla/lib/python3.8/site-packages/instagrapi/mixins/private.py", line 446, in private_request
    raise e
  File "/Users/kaiji/PycharmProjects/avotesla/lib/python3.8/site-packages/instagrapi/mixins/private.py", line 433, in private_request
    self._send_private_request(endpoint, **kwargs)
  File "/Users/kaiji/PycharmProjects/avotesla/lib/python3.8/site-packages/instagrapi/mixins/private.py", line 355, in _send_private_request
    raise UnknownError(**last_json)
instagrapi.exceptions.UnknownError: Invalid Tagged Users in this media

Expected behavior A clear and concise description of what you expected to happen. I expected for the post to succeed. Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

kaijif commented 2 years ago

nvm

Prakashmaheshwaran commented 1 year ago

solved?