Python search 400 error with bearer token authentication


I’ve got a very short python script that ends up with a 400 response, and I can’t for the life of me figure out why. Any help would be much appreciated:

import json
import requests
import urllib

twitter_app_credentials = {
	"api_key": (api key here),
	"api_secret_key": (secret key here)

response ="", headers={"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"}, data={"grant_type": "client_credentials"}, auth=(twitter_app_credentials["api_key"], twitter_app_credentials["api_secret_key"]))

if response.status_code != 200:
	print "Failed to obtain bearer token:"
	print response.status_code
	print response.content

deserialized_response = response.json()

if deserialized_response["token_type"] != "bearer":
	print "POST: failed to return a bearer token."
	print "a \"" + deserialized_response["token_type"] + "\" token was returned instead."

bearer_token = deserialized_response["access_token"]
print bearer_token

response = requests.get('', data={"q": "test"}, headers={'Authentication': 'Bearer %s' % bearer_token})

Could someone tell me what I’m missing here?