FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-core/control_structures/exception_https.py at master · Prabhakar-Naik/python-core · GitHub
Prabhakar-Naik
/
python-core
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-core
/
control_structures
/
exception_https.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
22 lines (19 loc) · 647 Bytes
Breadcrumbs
python-core
/
control_structures
/
exception_https.py
Copy path
File metadata and controls
22 lines (19 loc) · 647 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import
requests
# http requests
try
:
response
=
requests
.
get
(
'valid api uri for getting bulk data'
)
response
.
raise_for_status
()
# Raises HTTPError for bad responses
data
=
response
.
json
()
print
(
data
)
except
requests
.
exceptions
.
HTTPError
as
errh
:
print
(
"HTTP Error:"
,
errh
)
except
requests
.
exceptions
.
ConnectionError
as
errc
:
print
(
"Error Connecting:"
,
errc
)
except
requests
.
exceptions
.
Timeout
as
errt
:
print
(
"Timeout Error:"
,
errt
)
except
requests
.
exceptions
.
RequestException
as
err
:
print
(
"Request Error:"
,
err
)
else
:
print
(
"Request was successful."
)
finally
:
print
(
"End of network request handling."
)
Back
|
FazBrowse Home
|
New Git URL