How To Handle Errors & Exceptions with Requests and Python

preview_player
Показать описание
Learning how to raise and handle your exceptions properly in Python is an extremely useful skill especially when paired with good logging. It enables you to deal with (handle) them at the time and not suffer the consequences further down in your code.

In this video I'll show you a few basic examples of how to raise and log exceptions using the requests HTTP library for Python. We will look at the HTTPerror as well as the ConnctionError and log them accordingly.

Support Me:

-------------------------------------
Disclaimer: These are affiliate links and as an Amazon Associate I earn from qualifying purchases
-------------------------------------
Рекомендации по теме
Комментарии
Автор

I was searching for the same stuff and here I found it. Really helpful to make a log file of exceptions.

MuhammadAbdullah-lrsd
Автор

So useful! Thank you. Would be nice to see this going one step further, ie. send error email or txt msg, time out requests and bonus would be pre checks for when the source pages change…

ericxls
Автор

very quick and easily described. Thanks a lot

fruswlo
Автор

Thanx for this nice information. I am on vacation so could not see your some videos on time. 💖

tubelessHuma
Автор

Thanks for the video! What about handling the different error codes? What's the best practice for that? do we catch the HTTP error and check the codes in an if-else?

RaiOkami
Автор

Thank you so much you solved my problem for my requests More Subs to come. 👍👍

arff
Автор

the requests library is working slow in my laptop (80 secs), when i run the same code it works fast in macbook (0.5 secs). What could be the issue ?

rtxmax
Автор

Sent an email
I am stuck on passing return of a function to another functions. Could you please help me?

chilloutshow
Автор

What about csv, one of my csv writers works but the Seccond one doesn't?

strawberriesandcum