or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

entry-management.mdextensions.mdfeed-generation.mdfeed-metadata.mdindex.md

entry-management.mddocs/

0

# Entry Management

1

2

Functionality for creating, managing, and configuring individual feed entries with their metadata, content, and links.

3

4

## Capabilities

5

6

### FeedEntry Class

7

8

Represents individual entries/items within a feed.

9

10

```python { .api }

11

class FeedEntry:

12

def atom_entry(self, extensions=True):

13

"""

14

Generate ATOM entry XML element.

15

16

Args:

17

extensions (bool): Include loaded extensions

18

19

Returns:

20

lxml.etree._Element: ATOM entry element

21

"""

22

23

def rss_entry(self, extensions=True):

24

"""

25

Generate RSS item XML element.

26

27

Args:

28

extensions (bool): Include loaded extensions

29

30

Returns:

31

lxml.etree._Element: RSS item element

32

"""

33

```

34

35

### Entry Creation and Management

36

37

Methods for creating and managing entries within feeds.

38

39

```python { .api }

40

def add_entry(self, feedEntry=None, order='prepend'):

41

"""

42

Add new entry to feed.

43

44

Args:

45

feedEntry (FeedEntry, optional): Existing FeedEntry instance

46

order (str): 'prepend' or 'append' for entry ordering

47

48

Returns:

49

FeedEntry: The added entry instance

50

"""

51

52

def add_item(self, item=None):

53

"""

54

Alias for add_entry().

55

56

Args:

57

item (FeedEntry, optional): Existing FeedEntry instance

58

59

Returns:

60

FeedEntry: The added entry instance

61

"""

62

63

def remove_entry(self, entry):

64

"""

65

Remove entry from feed.

66

67

Args:

68

entry (FeedEntry): Entry instance to remove

69

"""

70

71

def remove_item(self, item):

72

"""

73

Alias for remove_entry().

74

75

Args:

76

item (FeedEntry): Entry instance to remove

77

"""

78

79

def entry(self, entry=None, replace=False):

80

"""

81

Set or get feed entries.

82

83

Args:

84

entry (list, optional): List of FeedEntry instances

85

replace (bool): Replace all entries instead of extending

86

87

Returns:

88

list: Current entries if no argument provided

89

"""

90

```

91

92

### Entry Metadata

93

94

Core metadata methods for individual entries.

95

96

```python { .api }

97

def title(self, title=None):

98

"""

99

Set or get entry title.

100

101

Args:

102

title (str, optional): Entry title

103

104

Returns:

105

str or None: Current title if no argument provided

106

"""

107

108

def id(self, id=None):

109

"""

110

Set or get entry ID.

111

112

Args:

113

id (str, optional): Unique entry identifier URL

114

115

Returns:

116

str or None: Current ID if no argument provided

117

"""

118

119

def guid(self, guid=None, permalink=False):

120

"""

121

Set or get RSS GUID.

122

123

Args:

124

guid (str, optional): Globally unique identifier

125

permalink (bool): Whether GUID is a permalink

126

127

Returns:

128

dict or None: Current GUID info if no argument provided

129

"""

130

```

131

132

### Entry Content

133

134

Methods for managing entry content and descriptions.

135

136

```python { .api }

137

def content(self, content=None, src=None, type=None):

138

"""

139

Set or get entry content.

140

141

Args:

142

content (str, optional): Entry content body

143

src (str, optional): External content source URL

144

type (str, optional): Content MIME type

145

146

Returns:

147

dict or None: Current content info if no argument provided

148

"""

149

150

def summary(self, summary=None, type=None):

151

"""

152

Set or get entry summary.

153

154

Args:

155

summary (str, optional): Entry summary text

156

type (str, optional): Summary content type

157

158

Returns:

159

dict or None: Current summary info if no argument provided

160

"""

161

162

def description(self, description=None, isSummary=False):

163

"""

164

Set or get RSS description.

165

166

Args:

167

description (str, optional): Entry description

168

isSummary (bool): Whether description is summary-only

169

170

Returns:

171

str or None: Current description if no argument provided

172

"""

173

```

174

175

### Entry Links and Media

176

177

Manage entry links, enclosures, and media attachments.

178

179

```python { .api }

180

def link(self, link=None, replace=False, **kwargs):

181

"""

182

Set or get entry links.

183

184

Args:

185

link (dict or list, optional): Link information

186

replace (bool): Replace existing links instead of appending

187

**kwargs: Link fields as keyword arguments

188

189

Returns:

190

list: Current links if no argument provided

191

"""

192

193

def enclosure(self, url=None, length=None, type=None):

194

"""

195

Set or get RSS enclosure (media attachment).

196

197

Args:

198

url (str, optional): Enclosure URL

199

length (str, optional): File size in bytes

200

type (str, optional): MIME type

201

202

Returns:

203

dict or None: Current enclosure info if no argument provided

204

"""

205

206

def comments(self, comments=None):

207

"""

208

Set or get entry comments URL.

209

210

Args:

211

comments (str, optional): Comments page URL

212

213

Returns:

214

str or None: Current comments URL if no argument provided

215

"""

216

```

217

218

### Entry Timestamps

219

220

Manage entry publication and update timestamps.

221

222

```python { .api }

223

def updated(self, updated=None):

224

"""

225

Set or get entry updated timestamp.

226

227

Args:

228

updated (datetime or str, optional): Last updated timestamp

229

230

Returns:

231

datetime or None: Current updated timestamp if no argument provided

232

"""

233

234

def published(self, published=None):

235

"""

236

Set or get entry published timestamp.

237

238

Args:

239

published (datetime or str, optional): Publication timestamp

240

241

Returns:

242

datetime or None: Current published timestamp if no argument provided

243

"""

244

245

def pubDate(self, pubDate=None):

246

"""

247

Set or get RSS publication date.

248

249

Args:

250

pubDate (datetime or str, optional): Publication timestamp

251

252

Returns:

253

datetime or None: Current pubDate if no argument provided

254

"""

255

256

def pubdate(self, pubDate=None):

257

"""

258

Deprecated alias for pubDate(). Use published() or pubDate() instead.

259

260

Args:

261

pubDate (datetime or str, optional): Publication timestamp

262

263

Returns:

264

datetime or None: Current pubDate if no argument provided

265

266

Note:

267

This method is deprecated and may be removed in feedgen ≥ 0.8

268

"""

269

```

270

271

### Entry Authors and Contributors

272

273

Manage entry-level author and contributor information.

274

275

```python { .api }

276

def author(self, author=None, replace=False, **kwargs):

277

"""

278

Set or get entry author(s).

279

280

Args:

281

author (dict or list, optional): Author information

282

replace (bool): Replace existing authors instead of appending

283

**kwargs: Author fields as keyword arguments

284

285

Returns:

286

list: Current authors if no argument provided

287

"""

288

289

def contributor(self, contributor=None, replace=False, **kwargs):

290

"""

291

Set or get entry contributor(s).

292

293

Args:

294

contributor (dict or list, optional): Contributor information

295

replace (bool): Replace existing contributors instead of appending

296

**kwargs: Contributor fields as keyword arguments

297

298

Returns:

299

list: Current contributors if no argument provided

300

"""

301

```

302

303

### Entry Categories and Classification

304

305

Organize entries with categories and tags.

306

307

```python { .api }

308

def category(self, category=None, replace=False, **kwargs):

309

"""

310

Set or get entry categories.

311

312

Args:

313

category (dict or list, optional): Category information

314

replace (bool): Replace existing categories instead of appending

315

**kwargs: Category fields as keyword arguments

316

317

Returns:

318

list: Current categories if no argument provided

319

"""

320

```

321

322

### Additional Entry Metadata

323

324

Other entry-specific metadata fields.

325

326

```python { .api }

327

def rights(self, rights=None):

328

"""

329

Set or get entry rights/copyright.

330

331

Args:

332

rights (str, optional): Rights/copyright statement

333

334

Returns:

335

str or None: Current rights if no argument provided

336

"""

337

338

def source(self, url=None, title=None):

339

"""

340

Set or get entry source information.

341

342

Args:

343

url (str, optional): Source URL

344

title (str, optional): Source title

345

346

Returns:

347

dict or None: Current source info if no argument provided

348

"""

349

350

def ttl(self, ttl=None):

351

"""

352

Set or get entry time-to-live.

353

354

Args:

355

ttl (int, optional): TTL in minutes

356

357

Returns:

358

int or None: Current TTL if no argument provided

359

"""

360

```

361

362

## Usage Examples

363

364

### Creating and Managing Entries

365

366

```python

367

from feedgen.feed import FeedGenerator

368

369

fg = FeedGenerator()

370

# ... set up feed metadata ...

371

372

# Add new entries

373

entry1 = fg.add_entry()

374

entry2 = fg.add_entry(order='append') # Add to end instead of beginning

375

376

# Remove entries

377

fg.remove_entry(entry1)

378

379

# Get all entries

380

all_entries = fg.entry()

381

print(f"Feed has {len(all_entries)} entries")

382

```

383

384

### Basic Entry Setup

385

386

```python

387

# Create entry with required metadata

388

fe = fg.add_entry()

389

fe.id('http://example.com/posts/first-post')

390

fe.title('My First Blog Post')

391

fe.description('This is my first blog post about Python programming')

392

393

# Set publication timestamp

394

from datetime import datetime

395

import dateutil.tz

396

fe.published(datetime.now(dateutil.tz.tzutc()))

397

398

# Add link to full article

399

fe.link(href='http://example.com/posts/first-post', rel='alternate')

400

```

401

402

### Rich Content Entries

403

404

```python

405

# Entry with HTML content

406

fe.content("""

407

<p>This is a <strong>rich HTML</strong> blog post with formatting.</p>

408

<ul>

409

<li>Lists</li>

410

<li>Links: <a href="http://example.com">Example</a></li>

411

<li>Code: <code>print("Hello World")</code></li>

412

</ul>

413

""", type='html')

414

415

# Entry with external content

416

fe.content(src='http://example.com/posts/full-content.html', type='html')

417

418

# Summary for RSS readers

419

fe.summary('A brief summary of the full post content...')

420

```

421

422

### Media and Attachments

423

424

```python

425

# Add media enclosure (podcast, video, etc.)

426

fe.enclosure(

427

url='http://example.com/podcast/episode001.mp3',

428

length='15360000', # Size in bytes

429

type='audio/mpeg'

430

)

431

432

# Comments link

433

fe.comments('http://example.com/posts/first-post#comments')

434

435

# Source attribution

436

fe.source(

437

url='http://originalblog.example.com/feed',

438

title='Original Blog'

439

)

440

```

441

442

### Entry Categorization

443

444

```python

445

# Add categories/tags

446

fe.category(term='python', label='Python Programming')

447

fe.category([

448

{'term': 'web-development', 'label': 'Web Development'},

449

{'term': 'tutorial', 'label': 'Tutorial'}

450

])

451

452

# Entry-specific author (different from feed author)

453

fe.author({

454

'name': 'Guest Author',

455

'email': 'guest@example.com'

456

})

457

```