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'>

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'skip:u 30': 0.07; "subject:' ": 0.07; '40,': 0.09; 'subject: <': 0.09; 'subject:module': 0.09; 'cc:addr:python-list': 0.11; 'callable': 0.16; 'cc:name:python list': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:class': 0.16; 'subject:object': 0.16; 'subject:python3': 0.16; 'subject:type': 0.16; 'typeerror:': 0.16; 'for?': 0.16; 'wrote:': 0.18; 'module': 0.19; 'examples': 0.20; 'import': 0.22; 'cc:addr:python.org': 0.22; 'forms.': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'skip:" 40': 0.26; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; 'dec': 0.30; 'matching': 0.30; 'message-id:@mail.gmail.com': 0.30; 'work.': 0.31; 'code': 0.31; 'file': 0.32; 'skip:_ 10': 0.34; 'problem': 0.35; 'skip:u 20': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'data,': 0.36; 'should': 0.36; 'two': 0.37; 'follows:': 0.38; 'expect': 0.39; 'either': 0.39; 'skip:p 20': 0.39; 'called': 0.40; "you're": 0.61; 'subject:skip:h 20': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=rw+xQ6OJG64wBATIBHwJ9cCba1pj/yJk8Ovj1gQSqNQ=; b=pmCSqshmnf8z20ZMglaLBLIRnspjdWvIsNbTCMNUQ5XMc9fzDUGQookqm9KxcQDmG0 Gfm3i3DxLmtsyHnh/pWdOeUus9szDJioDbxa/ciTxTBWBLxb9cXPnIxzmCwBtR4h3YJU HsPtufhh1mbbA9JlQHhvtvaiPwXZpOTUBUMp7dcP8XXxOb/I7+K8YapYzlK1blfvw1cB ifKrQVCl+6cCw23B/8JcVG5BsYEvn8kbiwDdUrzlc8EllfaSZbrl6C5okap6SREvcqRb YRzExN+4Ao+ky3jDbqkA7B6r4jr3/nvFSKpePiNAKzITPD0QrNXXjDbkXoWIsXCcnxdg 5S/Q==
MIME-Version 1.0
X-Received by 10.50.61.140 with SMTP id p12mr7631260igr.34.1417599758961; Wed, 03 Dec 2014 01:42:38 -0800 (PST)
In-Reply-To <AE613CD3-0BEE-41F6-A0BD-34773A917DA2@evenprimes.com>
References <AE613CD3-0BEE-41F6-A0BD-34773A917DA2@evenprimes.com>
Date Wed, 3 Dec 2014 20:42:38 +1100
Subject Re: python3: 'module' object is not callable - type is <class 'http.client.HTTPResponse'>
From Chris Angelico <rosuav@gmail.com>
Cc python list <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16523.1417599762.18130.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1417599762 news.xs4all.nl 2964 [2001:888:2000:d::a6]:58703
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81848

Show key headers only | 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