Regarding requests package for pythone


#1

Please advice me the package name for requests function for I python . I am working on one urgent requirement wherein I need to crawl in web pages


#2

I am sorry, the question is a bit foggy. Do you need a way of executing Python code from Atom? If that’s the case, you could try with Hydrogen.


#3

Sorry for the confusion .

I am working on one project wherein i need to use “import requests” and need to use beautifulsoup library .Basically I am working on web crawler kind of project .


#4

I think you’re over-thinking it. If you’re following a tutorial that has the line import requests, it seems likely that they’re using the requests package unless the tutorial says otherwise. I found that by going to PyPi and looking for a package just named requests.


#5

Yes exactly … but when I am using below

import requests
res = requests.get(“https://en.wikipedia.org/wiki/Cat”)

I am getting below error

Traceback (most recent call last):
File “C:\Users\Gaurav\AppData\Local\atom\app-1.23.3\Wiki\Test.py”, line 2, in
import requests
ImportError: No module named ‘requests’

Process returned 1 (0x1) execution time : 0.116 s
Press any key to continue . . .


#6

A few things:

  1. Have you installed requests?

  2. How many versions of Python do you have installed on the computer?

  3. What package are you using to enable Atom to run Python? You always need to specify.

  4. You should not have a project folder inside Atom’s install directory. That directory will go away eventually as more versions of Atom get downloaded and I’m about 80% sure that, if you keep your project there, it will disappear on you during an update. Put your projects somewhere else on your computer.


#7

Actually I am first time using Atom … could you pls help which package contains requests lib ?


#8

I’ve given you a link to the PyPi page. You install it using pip. Atom has no ability to download Python packages for you, though you can download Atom packages that can run CLI commands.


#9

Thanks man


#10

As @DamnedScholar already said, this is not an Atom related issue. Python is just trying to use a package that is not installed, either from your system Python or from your virtual environment.

In order to fix that, just run this command to install requests globally, for your default Python version:

sudo pip install requests

I would suggest to use virtualenv anyway, with maybe the support of virtualenvwrapper. With virtual environments, you can achieve isolation, and will have more control on what’s going on.

To automatize your Python workflow with Atom, there’s plenty of packages to run Python code, you just have to pick one!


#11

Its done Man :slight_smile: Thanks a ton