or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

blog-operations.mdindex.mdpost-management.mduser-operations.md

blog-operations.mddocs/

0

# Blog Operations

1

2

Comprehensive blog management functionality including information retrieval, post access, follower management, queue and draft handling, and blog-specific content operations. These methods can operate on any public blog or authenticated user's own blogs.

3

4

## Capabilities

5

6

### Blog Information

7

8

Retrieve detailed information about any blog including description, avatar, post counts, and settings.

9

10

```python { .api }

11

def blog_info(self, blogname: str) -> dict:

12

"""

13

Get information about a specific blog.

14

15

Args:

16

blogname (str): Blog URL (e.g., 'example.tumblr.com' or 'example')

17

18

Returns:

19

dict: Blog information including name, description, post count, and settings

20

"""

21

22

def avatar(self, blogname: str, size: int = 64) -> dict:

23

"""

24

Get blog's avatar URL.

25

26

Args:

27

blogname (str): Blog URL (e.g., 'example.tumblr.com' or 'example')

28

size (int, optional): Avatar size in pixels (16, 24, 30, 40, 48, 64, 96, 128, 512)

29

30

Returns:

31

dict: Avatar URL and metadata

32

"""

33

```

34

35

Usage examples:

36

37

```python

38

# Get blog information

39

blog_info = client.blog_info('codingjester.tumblr.com')

40

print(f"Blog: {blog_info['response']['blog']['title']}")

41

print(f"Posts: {blog_info['response']['blog']['posts']}")

42

43

# Get different avatar sizes

44

small_avatar = client.avatar('example-blog', size=30)

45

large_avatar = client.avatar('example-blog', size=512)

46

```

47

48

### Post Retrieval

49

50

Access posts from any blog with comprehensive filtering, pagination, and content format options.

51

52

```python { .api }

53

def posts(self, blogname: str, type: str = None, **kwargs) -> dict:

54

"""

55

Get posts from a blog.

56

57

Args:

58

blogname (str): Blog URL (e.g., 'example.tumblr.com' or 'example')

59

type (str, optional): Filter by post type ('text', 'photo', 'quote', 'link', 'chat', 'audio', 'video')

60

61

Parameters:

62

id (int, optional): Specific post ID to retrieve

63

tag (str, optional): Filter posts by tag

64

limit (int, optional): Number of posts to return (default: 20, max: 20)

65

offset (int, optional): Post number to start at for pagination

66

before (int, optional): Timestamp for posts before this time

67

reblog_info (bool, optional): Include reblog information

68

notes_info (bool, optional): Include notes information

69

filter (str, optional): Post format ('html', 'text', 'raw')

70

api_key (str, optional): For public access without authentication

71

npf (bool, optional): Returns posts in Neue Post Format

72

73

Returns:

74

dict: Blog posts and metadata

75

"""

76

```

77

78

Usage examples:

79

80

```python

81

# Get latest posts from a blog

82

posts = client.posts('codingjester.tumblr.com', limit=10)

83

84

# Get only photo posts

85

photos = client.posts('photography-blog', type='photo', limit=20)

86

87

# Get specific post by ID

88

specific_post = client.posts('example-blog', id=123456789)

89

90

# Get posts with specific tag

91

tagged_posts = client.posts('art-blog', tag='digital-art', limit=15)

92

93

# Get posts in text format

94

text_posts = client.posts('writing-blog', type='text', filter='text')

95

```

96

97

### Social Connections

98

99

Manage and view blog relationships including followers and following lists.

100

101

```python { .api }

102

def followers(self, blogname: str, **kwargs) -> dict:

103

"""

104

Get followers of a blog.

105

106

Args:

107

blogname (str): Blog URL (e.g., 'example.tumblr.com' or 'example')

108

109

Parameters:

110

limit (int, optional): Number of followers to return (default: 20, max: 20)

111

offset (int, optional): Follower number to start at for pagination

112

113

Returns:

114

dict: List of followers and total count

115

"""

116

117

def blog_following(self, blogname: str, **kwargs) -> dict:

118

"""

119

Get publicly exposed blogs that a blog follows.

120

121

Args:

122

blogname (str): Blog URL (e.g., 'example.tumblr.com' or 'example')

123

124

Parameters:

125

limit (int, optional): Number of blogs to return (default: 20, max: 20)

126

offset (int, optional): Blog number to start at for pagination

127

128

Returns:

129

dict: List of followed blogs

130

"""

131

132

def blog_likes(self, blogname: str, **kwargs) -> dict:

133

"""

134

Get liked posts from a blog (if publicly visible).

135

136

Args:

137

blogname (str): Blog URL (e.g., 'example.tumblr.com' or 'example')

138

139

Parameters:

140

limit (int, optional): Number of likes to return (default: 20, max: 20)

141

offset (int, optional): DEPRECATED - Like number to start at

142

before (int, optional): Timestamp for likes before this time

143

after (int, optional): Timestamp for likes after this time

144

145

Returns:

146

dict: Liked posts if publicly visible

147

"""

148

```

149

150

Usage examples:

151

152

```python

153

# Get blog followers

154

followers = client.followers('popular-blog.tumblr.com', limit=50)

155

print(f"Followers: {followers['response']['total_users']}")

156

157

# Get blogs that a blog follows (if public)

158

following = client.blog_following('example-blog')

159

160

# Get public likes from a blog

161

likes = client.blog_likes('public-blog', limit=10)

162

```

163

164

### Content Management

165

166

Access and manage blog content including queued posts, drafts, and submissions (requires blog ownership).

167

168

```python { .api }

169

def queue(self, blogname: str, **kwargs) -> dict:

170

"""

171

Get queued posts for a blog (requires ownership).

172

173

Args:

174

blogname (str): Blog URL (e.g., 'example.tumblr.com' or 'example')

175

176

Parameters:

177

limit (int, optional): Number of posts to return (default: 20, max: 20)

178

offset (int, optional): Post number to start at for pagination

179

filter (str, optional): Post format ('html', 'text', 'raw')

180

npf (bool, optional): Returns posts in Neue Post Format

181

182

Returns:

183

dict: Queued posts for the blog

184

"""

185

186

def drafts(self, blogname: str, **kwargs) -> dict:

187

"""

188

Get draft posts for a blog (requires ownership).

189

190

Args:

191

blogname (str): Blog URL (e.g., 'example.tumblr.com' or 'example')

192

193

Parameters:

194

filter (str, optional): Post format ('html', 'text', 'raw')

195

npf (bool, optional): Returns posts in Neue Post Format

196

197

Returns:

198

dict: Draft posts for the blog

199

"""

200

201

def submission(self, blogname: str, **kwargs) -> dict:

202

"""

203

Get submission posts for a blog (requires ownership).

204

205

Args:

206

blogname (str): Blog URL (e.g., 'example.tumblr.com' or 'example')

207

208

Parameters:

209

offset (int, optional): Post number to start at for pagination

210

filter (str, optional): Post format ('html', 'text', 'raw')

211

npf (bool, optional): Returns posts in Neue Post Format

212

213

Returns:

214

dict: Submission posts for the blog

215

"""

216

```

217

218

Usage examples:

219

220

```python

221

# Get queued posts (own blog only)

222

queue = client.queue('my-blog.tumblr.com', limit=10)

223

224

# Get draft posts (own blog only)

225

drafts = client.drafts('my-blog.tumblr.com', filter='html')

226

227

# Get submissions (own blog only)

228

submissions = client.submission('my-blog.tumblr.com')

229

```

230

231

## Blog Name Validation

232

233

PyTumblr automatically normalizes blog names by adding the `.tumblr.com` suffix when needed:

234

235

```python

236

# These are equivalent:

237

client.blog_info('example')

238

client.blog_info('example.tumblr.com')

239

240

# Custom domains work too:

241

client.blog_info('myblog.com')

242

```

243

244

## Error Handling

245

246

Blog operation methods return JSON responses with standard error handling:

247

248

```python

249

response = client.blog_info('nonexistent-blog')

250

if response.get('meta', {}).get('status') != 200:

251

print(f"Error: {response.get('meta', {}).get('msg')}")

252

```

253

254

Common error responses:

255

- **401 Unauthorized**: Authentication required for private content

256

- **403 Forbidden**: Access denied (private blog, restricted content)

257

- **404 Not Found**: Blog doesn't exist

258

- **429 Too Many Requests**: Rate limit exceeded