Max retries exceeded with url in Requests Python
Add headers.
Disguise the browser.
import requests
headers = {
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36'}
url_1 = 'http://www.dsit.org.ir/?cmd=page&Cid=92&title=Kontakt&lang=fa'
print(requests.get(url=url_1, headers=headers).text)
Python API call using requests throws Max retries exceeded with url error
requests
expects a certificate with the PEM
format your .pfx
file is in the PKCS#12
format.
You can either change your certificate format : Converting pfx to pem using openssl.
Or you can use this library that adds PKCS#12 support to requests.
Max retries exceeded with url and certificate verify failed while using Python requests
You are getting the error because the site's certificate is expired. You can modify the code as below to bypass verification.
Also make a note that you shouldn't do this with untrusted sites.
import requests
my_lat = 51.507
my_long = -0.1277
parameters = {"lat": my_lat, "lng": my_long}
response = requests.get(
"https://api.sunrise-sunset.org/json", params=parameters, verify=False
)
response.raise_for_status()
data = response.json()
print(data)
Related Topics
"Fire and Forget" Python Async/Await
How to Display Pandas Dataframe of Floats Using a Format String for Columns
Generate 'N' Unique Random Numbers Within a Range
What Does the 'U' Symbol Mean in Front of String Values
Fast Haversine Approximation (Python/Pandas)
How to Bind Self Events in Tkinter Text Widget After It Will Binded by Text Widget
Multiprocessing Global Variable Updates Not Returned to Parent
Shooting a Bullet in Pygame in the Direction of Mouse
Create a Directly-Executable Cross-Platform Gui App Using Python
Importerror: No Module Named Requests
How to Use a Dll File from Python
Rotate Axis Text in Python Matplotlib
How to Remove a Substring from the End of a String
Find Common Substring Between Two Strings
Can Not Click on a Element: Elementclickinterceptedexception in Splinter/Selenium