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


Groups > comp.lang.python > #75295 > unrolled thread

Re: NameError: name 'requests' is not defined ?

Started byDan Stromberg <drsalists@gmail.com>
First post2014-07-27 21:23 -0700
Last post2014-07-27 21:23 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: NameError: name 'requests' is not defined ? Dan Stromberg <drsalists@gmail.com> - 2014-07-27 21:23 -0700

#75295 — Re: NameError: name 'requests' is not defined ?

FromDan Stromberg <drsalists@gmail.com>
Date2014-07-27 21:23 -0700
SubjectRe: NameError: name 'requests' is not defined ?
Message-ID<mailman.12375.1406521444.18130.python-list@python.org>
On Sun, Jul 27, 2014 at 8:52 PM, 水静流深 <1248283536@qq.com> wrote:
> there is a simple file `mydown.py`  saved in `D:\Python34\Lib\site-packages`
> there is only one line in mydown.py .
>
> import requests
>
>
>
> C:\Users\pengsir>d:\Python34\python
> Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit
> (AM
> D64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import mydown
>>>> dir(mydown)
> ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__',
> '__name__',
> '__package__', '__spec__', 'requests']
>>>> url='http://quote.eastmoney.com/hk/02222.html?StockCode=02222'
>>>> requests.get(url)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> NameError: name 'requests' is not defined
>
> why it run into   "NameError: name 'requests' is not defined"?‍

Perhaps try "mydown.requests.get(url)"?

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web