A Python API v2 wrapper for Tumblr providing comprehensive methods for user, blog, and post operations with OAuth authentication
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Core functionality for authenticated user operations including account information, dashboard access, likes management, following/unfollowing blogs, and social interactions. These methods require valid OAuth credentials and operate on behalf of the authenticated user.
Get information about the currently authenticated user including blog details, follower counts, and account settings.
def info(self) -> dict:
"""
Get information about the current authenticated user.
Returns:
dict: User information including name, blogs, follower counts, and preferences
"""Usage example:
user_info = client.info()
print(f"User: {user_info['response']['user']['name']}")
print(f"Blogs: {len(user_info['response']['user']['blogs'])}")Retrieve posts from the authenticated user's dashboard (home feed) with filtering and pagination options.
def dashboard(self, **kwargs) -> dict:
"""
Get dashboard posts for authenticated user.
Parameters:
limit (int, optional): Number of posts to return (default: 20, max: 20)
offset (int, optional): Post number to start at for pagination
type (str, optional): Filter by post type ('text', 'photo', 'quote', 'link', 'chat', 'audio', 'video')
since_id (int, optional): Return posts that have appeared after this ID
reblog_info (bool, optional): Include reblog information
notes_info (bool, optional): Include notes information
Returns:
dict: Dashboard posts and metadata
"""Usage example:
# Get latest 10 posts from dashboard
dashboard = client.dashboard(limit=10, reblog_info=True)
# Get only photo posts
photos = client.dashboard(type='photo', limit=5)
# Get posts since specific ID
recent = client.dashboard(since_id=12345)Access and manage the authenticated user's liked posts with pagination support.
def likes(self, **kwargs) -> dict:
"""
Get liked posts for authenticated user.
Parameters:
limit (int, optional): Number of likes to return (default: 20, max: 20)
offset (int, optional): DEPRECATED - Like number to start at for pagination
before (int, optional): Timestamp for likes before this time
after (int, optional): Timestamp for likes after this time
Returns:
dict: Liked posts and pagination metadata
"""Usage example:
# Get recent likes
likes = client.likes(limit=10)
# Get likes before specific timestamp
older_likes = client.likes(before=1234567890)Manage the blogs that the authenticated user follows, including retrieval and follow/unfollow operations.
def following(self, **kwargs) -> dict:
"""
Get blogs followed by authenticated user.
Parameters:
limit (int, optional): Number of blogs to return (default: 20, max: 20)
offset (int, optional): Blog number to start at for pagination
Returns:
dict: List of followed blogs and total count
"""
def follow(self, blogname: str) -> dict:
"""
Follow a blog.
Args:
blogname (str): Blog URL to follow (e.g., 'example.tumblr.com' or 'example')
Returns:
dict: Success/failure response
"""
def unfollow(self, blogname: str) -> dict:
"""
Unfollow a blog.
Args:
blogname (str): Blog URL to unfollow (e.g., 'example.tumblr.com' or 'example')
Returns:
dict: Success/failure response
"""Usage examples:
# Get followed blogs
followed = client.following(limit=50)
print(f"Following {followed['response']['total_blogs']} blogs")
# Follow a blog
client.follow('codingjester.tumblr.com')
# Unfollow a blog
client.unfollow('example-blog') # .tumblr.com suffix is added automaticallyLike and unlike posts across the Tumblr platform.
def like(self, id: int, reblog_key: str) -> dict:
"""
Like a post.
Args:
id (int): The post ID to like
reblog_key (str): The reblog key of the post (found in post JSON)
Returns:
dict: Success/failure response
"""
def unlike(self, id: int, reblog_key: str) -> dict:
"""
Unlike a post.
Args:
id (int): The post ID to unlike
reblog_key (str): The reblog key of the post (found in post JSON)
Returns:
dict: Success/failure response
"""Usage examples:
# Like a post (ID and reblog_key from post JSON response)
response = client.like(123456789, 'abc123def456')
# Unlike a post
response = client.unlike(123456789, 'abc123def456')
# Example: Like posts from dashboard
dashboard = client.dashboard(limit=5)
for post in dashboard['response']['posts']:
if post['type'] == 'photo': # Only like photo posts
client.like(post['id'], post['reblog_key'])All user operation methods return JSON responses with standard Tumblr API error handling:
response = client.info()
if response.get('meta', {}).get('status') == 200:
user_data = response['response']['user']
else:
print(f"Error: {response.get('meta', {}).get('msg')}")Common error responses:
Install with Tessl CLI
npx tessl i tessl/pypi-pytumblr