Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

typeerror 'bytes' object is not callable

My code:

import psycopg2
import requests
from urllib.request import urlopen
import urllib.parse
uname = " **** "
pwd = " ***** "
resp = requests.get("https://api.flipkart.net/sellers/skus/SKUID/listings", auth=(uname, pwd))
con_page = resp.content()
print (con_page)

I am getting this error:

Traceback (most recent call last):

File "C:\Users\Prime\Documents\NetBeansProjects\Fp_API\src\fp_api.py", line 18, in <module>

    con_page = resp.content()

TypeError: 'bytes' object is not callable
like image 374
Manish Gupta Avatar asked Dec 16 '14 07:12

Manish Gupta


1 Answers

Based on the documentation, the return value of requests.get() is a requests.Response, which has a content field with the type bytes, rather than a content() method.

Try this instead:

con_page = resp.content
like image 142
merlin2011 Avatar answered Oct 28 '22 23:10

merlin2011