So I’m trying to create a system to index users in a search database, but pyramid and the requests library are failing me. This is the piece of code messing up:
requests.put('http://localhost:9200/master/user/%s' % str(session.query(User).filter(User.username == request.params['username']).first().user_id)
, data = '{"name" : %s, "reputation" : 0, "username" : %s}' % (str(request.params['name']), str(request.params['username']))
)
It works in the python interpreter fine, but in the view, it keeps returning a 400 status. I do run session.flush() before this line of code. I can’t figure out what is going wrong.
1 Answer