Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request vs Requests module in Python

Can anyone tell me what the difference between the request and the popular requests module is in Python?

like image 653
H Scherrebeck Avatar asked May 20 '18 21:05

H Scherrebeck


People also ask

What is the requests module in Python?

The requests module allows you to send HTTP requests using Python. The HTTP request returns a Response Object with all the response data (content, encoding, status, etc).

Is requests a library or package?

Requests is a popular open source HTTP library that simplifies working with HTTP requests. The Requests library is available for both Python 2 and Python 3 from the Python Package Index (PyPI), and has the following features: Allows you to send HTTP/1.1 PUT, DELETE, HEAD, GET and OPTIONS requests with ease.

Is requests a library in Python?

The requests library is the de facto standard for making HTTP requests in Python. It abstracts the complexities of making requests behind a beautiful, simple API so that you can focus on interacting with services and consuming data in your application.

What is the alternative for requests module in Python?

Top Alternatives to requestsPytest: simple powerful testing with Python. Python wrapper for the Cloudflare v4 API. Powerful data structures for data analysis, time series, and statistics. The modular source code checker: pep8, pyflakes and co.


2 Answers

From the PYPI --> https://pypi.org/project/request/

From Github -- > https://github.com/looking-for-a-job/request.py

It seems like an uncompleted module. Just uninstall it with,

pip uninstall request

and then install the requests module with pip install requests.

like image 68
BcK Avatar answered Oct 19 '22 02:10

BcK


request is the http request and you use it when you writing a code and you want to access the HTTP request data which hit your function, for example request.method or request .user

def GetUser(request):
 return request.user 

requests is library you need to install it, the liverary give your code the ability to act like browser kind of, where your code hit websites and get data from it

pip install requests
response = requests.get('https://api.github.com')
response.status_code

this will print out 200 OK

like image 3
Fahd Mannaa Avatar answered Oct 19 '22 04:10

Fahd Mannaa