Q:

python facebook-sdk posts with location

I'm using the python facebook-sdk and want to find all posts in my news feed that have a location tagged. To get all posts in my news feed, I know I can use this:
graph = facebook.GraphAPI(USER_TOKEN)
feed = graph.get_connections("me", "home")

According to facebook's API docs if I want only posts with locations I need to add the argument 'with=location' to the end of the url generated by
feed = graph.get_connections("me", "home")

But when I try
feed = graph.get_connections("me", "home", with='location')

I get
SyntaxError: invalid syntax

What am I doing wrong?

A:

Since with is a python keyword, you can't use it as a keyword argument in a function call, as in:
any_function(with=5)

or in my case:
feed = graph.get_connections("me", "home", with='location')

The function definition for get_connections in the python facebook-sdk is
def get_connections(self, id, connection_name, **args):

Which means you can send with as a keyword argument by doing the following:
graph.get_connections('me','home', **{'with':'location'})

