# getting starred feed items from Newsblur via Python

One of the things I'd come to depend on when using FeverËš was a hand-rolled PHP utility script (cleverly called "Readinator") that grabbed all feed items that I'd starred in FeverËš in the last week and generated a list in Markdown syntax for easy copy/paste into my Week in Reviewâ„¢ posts (it also pulls links that I've added to my Scuttle bookmark server in the last week as well). After moving to Newsblur, my utility script obviously became less useful. Sadface.

But, Newsblur has an API. I could have probably tweaked my PHP script to use that, but I'm learning Python for use on projects so I took the opportunity to learn a bit more Python with a real-world scratch-my-own-itch project.

My Python-fu is very weak. Hell, my programming-fu in general has atrophied pretty horribly. So, after a few false starts (the Python-Newsblur wrapper looked promising, but it hadn't been updated in 6 years and I couldn't get it to do anything), I rolled up my sleeves and wrote something using the handy Requests python library.

It took a fair bit of trial and error, googling, and scratching of head, but I wound up with a script that logs in, stores a session ID, calls GET /reader/starred_stories, and iterates through the results to generate markdown.

Hey, presto! That's the meat of it - about 20 lines of code (I err on the side of readability over brevity, so it could have been compacted quite a bit). There's another bit that does the logging in and generation of the cookie to return with the GET /reader/starred_stories call.

And so, a preview of the Newsblur-powered portion of this week's Week in Review: Read section: