Loading video player…

Requests Introduction & Overview

In this lesson you’ll get a general overview about the requests library. Furthermore, it reveals you how to install requests on your machine using pip and how to import it. In fact it’s as easy as:

$ pip install requests

After installing requests you’re able to import into your project via:

import requests

When you’ve completed the course, take our interactive quiz to check your learning progress:

Take the Quiz: Test your knowledge with our interactive “HTTP Requests With the "requests" Library” quiz. You’ll receive a score upon completion to help you track your learning progress:

Interactive Quiz

HTTP Requests With the "requests" Library

Test your understanding of the Python "requests" library for making HTTP requests and interacting with web services.


Course Slides (PDF)

158.0 KB
Avatar image for Dominic

Dominic on March 14, 2019

Hi Chris, thanks for the tutorial :-) Getting to know bpython was already worth so much! I didn’t know it so far but it already helped me today to get an effortless look into some module functions!

Avatar image for Chris Bailey

Chris Bailey RP Team on March 15, 2019

Thanks so much Dominic! I’m really getting mileage out of bptyhon, its fantastic for inspecting elements.

Avatar image for Evan E

Evan E on May 1, 2019

Yeah, big ups on bpython. I’ve been using bpython since Dan Bader showed it back when he use to make YouTube vids;)

Avatar image for Dri

Dri on Oct. 15, 2019

Hi @ll, what’s the best way to install bpython? I’m getting error on homebrew and pip3…

Avatar image for emalfiza

emalfiza on Jan. 24, 2020

Hey Christ, why the bpython installation doesnt work? I tried in my Mac terminal and even in PyCharm terminal?

Avatar image for Chris Bailey

Chris Bailey RP Team on Jan. 24, 2020

Hi @emalfiza. I’m sorry you are having trouble with bpython. What type of error are you getting? What version of Python do you have, is it a version from Python.org or a different distribution, and which version of macOS? I have had lots of issues of late installing libraries/packages and python itself, as I had to start over with a new drive (SSD) in my Mac. Two of the problems I had involved for one the inability to compile the version of the package on my machine, and the other had to do with not having certificates installed. For the compiling I needed to update Xcode libraries, which the error I got in the terminal walked me through. The other issue with certificates had to do with the version of Python not automatically installing those certificates, and needing to go into the folder where Python is installed and click to run, Install Certificates.command.

In general the best method of installing is using python3 -m pip install bpython, but it would help to know what errors you are getting.

Avatar image for emalfiza

emalfiza on Jan. 24, 2020

Hey @ChristBailey grateful of your reply to the issue.

I have the Python3 3.8.0 version install in my MacOS Catalina version 10.15.2 and I have downloaded python3 from python.org.

I tried the commands that you have used in the HTTP requests module plus the python3 -m pip install bpython and as will as python3 -m pip3 install bpython, but no joy.

The errors that I get is really verbose:

 ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/hs/6gnsjkyn4wb27ztcqrvr_mrh0000gn/T/pip-install-_kxafe8y/greenlet/setup.py'"'"'; __file__='"'"'/private/var/folders/hs/6gnsjkyn4wb27ztcqrvr_mrh0000gn/T/pip-install-_kxafe8y/greenlet/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/hs/6gnsjkyn4wb27ztcqrvr_mrh0000gn/T/pip-record-167v2edn/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/greenlet
         cwd: /private/var/folders/hs/6gnsjkyn4wb27ztcqrvr_mrh0000gn/T/pip-install-_kxafe8y/greenlet/
    Complete output (9 lines):
    running install
    running build
    running build_ext
    building 'greenlet' extension
    creating build
    creating build/temp.macosx-10.9-x86_64-3.8
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c greenlet.c -o build/temp.macosx-10.9-x86_64-3.8/greenlet.o
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

By the way I really loved and enjoyed your tutorials.

Avatar image for Chris Bailey

Chris Bailey RP Team on Jan. 24, 2020

Hi @emalfiza, It looks like you are having a gcc compiler issue, but I’m not positive. The section (error:invalid active developer path(....CommandLineTools)) is referring to it being unable to find those tools I think. If you recently upgraded to Catalina, it can sometimes remove the tools, or makes other changes so that they don’t work. There is a terminal command to re-install them. xcode-select --install Here is a thread with more about it I found. I hope this helps.

Become a Member to join the conversation.