Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81848

Re: python3: 'module' object is not callable - type is <class 'http.client.HTTPResponse'>

References <AE613CD3-0BEE-41F6-A0BD-34773A917DA2@evenprimes.com>
Date 2014-12-03 20:42 +1100
Subject Re: python3: 'module' object is not callable - type is <class 'http.client.HTTPResponse'>
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.16523.1417599762.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Dec 2, 2014 at 6:45 AM, Chris Cioffi <chris@evenprimes.com> wrote:
>   File "/Users/chris/dev/LendingClub/lendingclub.py", line 40, in _make_api_call
>     pprint(lcresponse.read())
> TypeError: 'module' object is not callable
>
> The relevant code is as follows:
> lcrequest = urllib.request.Request(url, data, {"Authorization": authorizationKey})
> lcresponse = urllib.request.urlopen(lcrequest)
>
> Any ideas on what I should be looking for?  Based on the docs and examples I would expect this to work.

Your problem isn't with urllib, but with pprint. The pprint module
exposes a function called pprint; you can use it either like this:

from pprint import pprint
pprint(some_object)

Or like this:

import pprint
pprint.pprint(some_object)

It looks like you're mixing and matching the two forms.

All the best!

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: python3: 'module' object is not callable - type is <class 'http.client.HTTPResponse'> Chris Angelico <rosuav@gmail.com> - 2014-12-03 20:42 +1100

csiph-web