How to use add_url API

I’ve started playing with the API using Python Requests but cannot figure out how to use /reader/add_url properly. Why does the following code get a 403 response for add_url?

login ='', {'username': 'exampleuser', 'password': 'passw0rd'})   
print '/api/login', login   
addurl ='\_url', {'url' : ''})   
print '/reader/add\_url', addurl   
logout ='')   
1 Like

There are two ways to do this. First is the easy way: use the NewsBlur Python API:…. It uses urllib2, but the important part is the cookieJar it uses.

When you make that login call, you are given a cookie back, called “newsblur_sessionid”. You want to hold on to that cookie for subsequent calls. Requests allows you to do this quite easily. It’s called sessions and it bakes in this cookie passing:…

If you roll your own ad hoc API, just use requests.session() and you’ll be golden. And let me know what you’re building. I’d love to help out if I can.

Hi Sam

To be honest, I was just playing with Python and Requests, and happened to remember that Newsblur has a Python API.

I may actually write an Ubuntu app though. I’ll let you know when I have something to test.