[instagram] improve error for non-existent profiles (#8550)

This commit is contained in:
Mike Fährmann
2025-11-13 20:34:46 +01:00
parent 5cda64c8d8
commit e6930ebb23

View File

@@ -871,8 +871,11 @@ class InstagramRestAPI():
def user_by_name(self, screen_name):
endpoint = "/v1/users/web_profile_info/"
params = {"username": screen_name}
return self._call(
endpoint, params=params, notfound="user")["data"]["user"]
try:
return self._call(
endpoint, params=params, notfound="user")["data"]["user"]
except KeyError:
raise exception.NotFoundError("user")
@memcache(keyarg=1)
def user_by_id(self, user_id):