Error is not JSON serializable with Python and OAuth 2.0 Client ID API from Google

0

This is my Python code + OAuth 2.0 Client ID API:

#!/usr/bin/env python

from urllib import request
import urllib
import urllib.parse
import json
import requests

client_id='xxxxxxx.googleusercontent.com'
client_secret='xxxxxxxxxxxxxxx'

query = 'site:xxxxxxxxx.com intitle:"linux"  "vulnerability"'

dir_api='https://www.googleapis.com/customsearch/vi?key='
url=dir_api+client_secret+"&cx="+client_id+"&q="+urllib.parse.quote(query)

resultado = requests.get(url)
print( json.dumps(resultado.json, indent=4) )

The error that shows is:

raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <bound method Response.json of <Response [404]>> is not JSON serializable

I can not find information on the subject. I have installed requests

    
asked by Nahuel Jakobson 20.03.2017 в 20:59
source

0 answers