How to add a library in python - python

I am trying to authenticate jawbone api in python. In the code there is a line:
import requests
How can I add this. I have very little knowledge on python. Just manipulating the code. Can any one please help? The library is already present in python 3.3

This is only for the users using python33 and in windows platform,,,,
download Requests packages from any site.
Copy the folder Requests from the downloaded package and place it on C://python33/LIB/ folder....
now you are able to import Requests package to your program

Related

Error importing requests into python

I am writing a Merchant Data Export API in Python (Pydev plugin for eclipse) and I cannot import requests, is there some option for managing imports?
I have the requests-master folder in my project, downloaded from GitHub. I have read the following articles for downloadingand installing, but nothing works for me.
I am a new python user but would like to learn more.
Thanks for any help!
If you just do a pip install requests, things should work (the issue is that you probably aren't adding the proper folder to the PYTHONPATH for PyDev to recognize the requests module you downloaded... using pip should do the right thing for you without requiring further configurations).

Python requests are installed, but when trying to upload JSON via Python it says no such module exists

I'm using a Python upload file to connect an Apple News Format JSON file to my publisher. I've installed Python 3.6.1 and (I believe) 2.7 via Homebrew, and have used the following command to install requests:
$ pip3 install requests
This successfully installed the requests package. When dragging my "upload.py" file into Terminal, followed by "article.json", I receive the following error:
import requests
ImportError: No module named requests
Here is a screenshot to corroborate that these requests are, in fact, installed:
I have no idea what the problem is. Considering that I'm just doing this to change my article formatting, this is one hell of a job. I even downloaded the requests zip file to be certain. Can anyone tell me what the problem is?

Module requests Python

I am trying to use the requests module in a python script. I start by the import command and write the script however it is telling me that requests is not a module. Can anyone explain this to me? Is this not built in like "re" or do I have to import it in? I am new to python so any help would be great. Using Windows!
Thanks
Deirdre
No, requests is a 3rd party library. You can install it using pip.
pip install requests
And even if re is built-in, you have to import it in order to use it.

Importing requests module in python using netbeans

I'm using netbeans to write a simple python program which I need the requests module for, I've downloaded requests through terminal and it all seems to be fine there but netbeans can't seem to find it.
This is the error that it's throwing up:
import requests
ImportError: No module named requests
I've tried installing the requests library directly into the python folder but the folder won't let me paste anything into it.
There do seem to be answers on the netbeans forums but their server is down so won't let me on their website to my annoyance!
EDIT
I've tried to run python setup.py install as per other answers on the website but had no luck.
EDIT
have tried completely uninstalling python and requests to make sure it wasn't an installation error but still no luck.
This clearly looks like an error of installation of the request module to some other place than where your netbeans expects when running the code.
In your console run
which python
Check if this gives the same path as the one set in your netbeans. You can set your path by adding new platform using Tools > Python Platforms > New:
I would suggest that you learn bit more about sandboxed environments such as virtualenv. This article shows how you can use a virtualenv to install packages and use the same virtualenv for netbeans so that whatever packages you install in the virtualenv will be available in the netbeans for you to use. For this case, it could be requests.
In the end I gave up with requests, as I was using requests to get json data from an API I decided just to go back to the drawing board and start over rather than attempt to fix something that I couldn't work out. I am now using the urllib import and whilst this may not be the most efficient way it works which is the most important thing.

Python Google App Engine : best way to prevent html xss?

The solution of just removing all HTML tags is not apprioriate for my App.
From what I have seen so far, I have found two solutions to clean HTML in Python:
bleach (uses html5lib). It works perfectly well on dev server but I could not have it work on production. there is an 'ImportError: No module named html5lib' when I try to import html5lib. Just as if the folder was not there. Maybe a problem with the python path of GAE.
lxml. It is more complicated to have it work on dev server : must install two third party binaries (libxslt and libxml2) to my local Python and then pip install lxml. Then on production, once I declared the lxml library in my app.yaml, it worked just fine.
Are there better solutions than lxml?
Thanks in advance

Categories

Resources