gizgok
gizgok

Reputation: 7649

How to find out if a feed has updated without etag and modified headers in response?

I'm parsing an atom feed using feedparser. The response headers keys sent back when I make a request are date,content-length,content-type,charset,connection,server. Here's the starting point of the feed,

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Hello</title>
<link href="http://example.com/"/>
<link rel="self" href="http://example.com/feed"/>
<link rel="search" type="application/opensearchdescription+xml"             href="http://example/com/search.xml" title="Hello" />
<updated>2012-05-20T02:24:56Z</updated>
<id>abcd/</id>
<icon>abcd</icon>
<author><name>abcd</name></author>

The updated tag has the value of when the feed must have been last updated. Is it possible to send this updated value in a request header in feedparser.parse method? If yes which header would that be and then check for the response headers to see if it was updated? Any other way to find out if the feed has been updated besides this?

Upvotes: 0

Views: 598

Answers (1)

ext
ext

Reputation: 2903

You can set If-Modified-Since in your request and should get 304 Not Modified if the content hasn't been updated. If you get a 200 response but the content really isn't updated the server didn't honor the request and there is little you can do other than comparing the date or hash of the content.

Upvotes: 2

Related Questions