[instagram] improve error for non-existent profiles (#8550)
This commit is contained in:
@@ -871,8 +871,11 @@ class InstagramRestAPI():
|
|||||||
def user_by_name(self, screen_name):
|
def user_by_name(self, screen_name):
|
||||||
endpoint = "/v1/users/web_profile_info/"
|
endpoint = "/v1/users/web_profile_info/"
|
||||||
params = {"username": screen_name}
|
params = {"username": screen_name}
|
||||||
return self._call(
|
try:
|
||||||
endpoint, params=params, notfound="user")["data"]["user"]
|
return self._call(
|
||||||
|
endpoint, params=params, notfound="user")["data"]["user"]
|
||||||
|
except KeyError:
|
||||||
|
raise exception.NotFoundError("user")
|
||||||
|
|
||||||
@memcache(keyarg=1)
|
@memcache(keyarg=1)
|
||||||
def user_by_id(self, user_id):
|
def user_by_id(self, user_id):
|
||||||
|
|||||||
Reference in New Issue
Block a user