views:

29

answers:

0

I'm using the SyndicationFeed helper class to request and parse a Twitter RSS feed. I just discovered that I'm actually using the Twitter REST API by requesting RSS feed data. There's a limit to the number of requests per hour and that limit is actually returned in a response header called X-RateLimit-Remaining. I'd like to get that number and use it. Since I'm already using the SyndicationFeed class to access the RSS feed, is there a way for me to retrieve the X-RateLimit-Remaining header or do I need to completely change my code and manually make a web request to the feed? Below is my basic code to get the two most recent tweets. Note that I do actually have data caching logic in place around this code, but this is the core:

// rssUri is a string to the feed
XmlReader feed = XmlReader.Create(rssUri);
var latestItems = SyndicationFeed
        .Load(feed)
        .GetRss20Formatter()
        .Feed
        .Items
        .Take(2);