[tumblr] fix avatar URLs for non-OAuth1.0 calls (closes #193)

This commit is contained in:
Mike Fährmann
2019-03-17 10:50:44 +01:00
parent 8c20443839
commit fb14f80d62
3 changed files with 6 additions and 1 deletions

View File

@@ -334,6 +334,9 @@ class TumblrAPI(oauth.OAuth1API):
def avatar(self, blog, size="512"):
"""Retrieve a blog avatar"""
if self.api_key:
url_fmt = "https://api.tumblr.com/v2/blog/{}/avatar/{}?api_key={}"
return url_fmt.format(blog, size, self.api_key)
params = {"size": size}
data = self._call(blog, "avatar", params, allow_redirects=False)
return data["avatar_url"]