Python Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Python Examples

Quick Start
Unicode
Byte Array
Bz2
Certificates
CSV
Email
Encryption
FTP
HTML Conversion
HTTP
IMAP
MHT
MIME
POP3
RSA
S/MIME
Signatures
Socket / SSL
SFTP
SMTP
Spider
SSH Key
SSH
SSH Tunnel
Tar
HTTP Upload
XML
XMP
Zip

More Examples...
String
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

 

Read RSS Feed

Sample code showing how to read an RSS feed and display the contents.

The Chilkat RSS class/component is freeware.

 Chilkat Python Module Downloads for Windows, Linux, and MAC OS X

import sys
import chilkat

rss = chilkat.CkRss()

#  Download from the feed URL:
success = rss.DownloadRss("http://blog.chilkatsoft.com/?feed=rss2")
if (success != True):
    print rss.lastErrorText()
    sys.exit()

#  Get the 1st channel.

rssChannel = rss.GetChannel(0)
if (rssChannel == None ):
    print "No channel found in RSS feed."
    sys.exit()

#  Display the various pieces of information about the channel:
print "Title: " + rssChannel.getString("title")
print "Link: " + rssChannel.getString("link")
print "Description: " + rssChannel.getString("description")

#  For each item in the channel, display the title, link,
#  publish date, and categories assigned to the post.
numItems = rssChannel.get_NumItems()

for i in range(0,numItems):
    rssItem = rssChannel.GetItem(i)

    print "----"
    print "Title: " + rssItem.getString("title")
    print "Link: " + rssItem.getString("link")
    print "pubDate: " + rssItem.getString("pubDate")

    numCategories = rssItem.GetCount("category")

    if (numCategories > 0):
        for j in range(0,numCategories):
            print "    category: " + rssItem.mGetString("category",j)


 

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.