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


Groups > comp.lang.python > #81846

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

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <chris@evenprimes.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; 'api': 0.11; 'python': 0.11; "(i'm": 0.16; '49,': 0.16; 'callable': 0.16; 'received:10.5.19': 0.16; 'received:10.5.19.251': 0.16; 'received:filter.hostedemail.com': 0.16; 'received:hostedemail.com': 0.16; 'subject:class': 0.16; 'subject:object': 0.16; 'subject:python3': 0.16; 'subject:type': 0.16; 'to:name:python list': 0.16; 'typeerror:': 0.16; 'urllib': 0.16; 'for?': 0.16; 'trying': 0.19; 'examples': 0.20; 'error': 0.23; 'from:addr:chris': 0.24; 'script': 0.25; 'skip:" 40': 0.26; 'rest': 0.29; 'chris': 0.29; 'skip:p 30': 0.29; "i'm": 0.30; 'work.': 0.31; 'code': 0.31; 'file': 0.32; 'thanks!': 0.32; '(most': 0.33; 'skip:_ 10': 0.34; 'problem': 0.35; 'info': 0.35; 'skip:u 20': 0.35; 'but': 0.35; 'version': 0.36; 'data,': 0.36; 'charset:us-ascii': 0.36; 'should': 0.36; 'received:10': 0.37; 'clear': 0.37; 'follows:': 0.38; 'to:addr:python-list': 0.38; 'little': 0.38; 'recent': 0.39; 'expect': 0.39; '12,': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'skip:a 30': 0.61; 'received:173': 0.61; 'header:Message-Id:1': 0.63; 'decided': 0.64; 'production': 0.68; 'object:': 0.84; 'received:216.40': 0.84; 'subject:skip:h 20': 0.84
X-Session-Marker 6368726973406576656E7072696D65732E636F6D
X-Spam-Summary 2, 0, 0, , d41d8cd98f00b204, chris@evenprimes.com, :, RULES_HIT:41:355:379:541:564:960:967:973:982:988:989:1260:1277:1311:1313:1314:1345:1381:1437:1513:1515:1516:1518:1521:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2689:2895:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3870:3871:3874:4362:5007:6261:7903:8660:8957:9040:10004:10400:10848:11026:11473:11658:11914:12043:12114:12296:12438:12517:12519:12663:12679:13069:13073:13148:13161:13229:13230:13255:13311:13357:14344:21080, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0
X-HE-Tag tin22_eaa27e3ef705
X-Filterd-Recvd-Size 2172
From Chris Cioffi <chris@evenprimes.com>
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding quoted-printable
Subject python3: 'module' object is not callable - type is <class 'http.client.HTTPResponse'>
Date Mon, 1 Dec 2014 14:45:00 -0500
To python list <python-list@python.org>
Mime-Version 1.0 (Mac OS X Mail 8.1 \(1993\))
X-Mailer Apple Mail (2.1993)
X-Mailman-Approved-At Wed, 03 Dec 2014 09:00:25 +0100
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.16520.1417593626.18130.python-list@python.org> (permalink)
Lines 42
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1417593626 news.xs4all.nl 2868 [2001:888:2000:d::a6]:41790
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81846

Show key headers only | View raw


I'm writing a little script that uses a REST API and I'm having a problem using urllib in Python 3.

I had the basics working in Python 2.7, but for reasons I'm not clear on I decided to update to Python 3.  (I'm in the early phases, so this isn't production by any stretch.)


Python version info:
sys.version_info(major=3, minor=4, micro=2, releaselevel='final', serial=0)

Type() info of return object from urllib.request.urlopen:
<class 'http.client.HTTPResponse'>

Traceback of error when trying to pprint() the object:
Traceback (most recent call last):
  File "./test.py", line 59, in <module>
    testGetAvailableCash(lc)
  File "./test.py", line 12, in testGetAvailableCash
    print(lc.available_cash(INVESTORID, AUTHKEY))
  File "/Users/chris/dev/LendingClub/lendingclub.py", line 49, in available_cash
    return self._make_api_call(''.join((BASE_ACCOUNT_URL, investorID, "/availablecash")), authorizationKey)[u'availableCash']
  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. 

Thanks!

Chris

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


Thread

python3: 'module' object is not callable - type is <class 'http.client.HTTPResponse'> Chris Cioffi <chris@evenprimes.com> - 2014-12-01 14:45 -0500

csiph-web