Bored-API
Bored-API copied to clipboard
HTTPS Requests Not Working (Expired Certificate)
It looks like the Let's Encrypt certificate expired yesterday so HTTPS requests have issues:
Issued To:
Common Name (CN) www.boredapi.com
Organization (O) <Not Part Of Certificate>
Organizational Unit (OU) <Not Part Of Certificate>
Issued By:
Common Name (CN) R3
Organization (O) Let's Encrypt
Organizational Unit (OU) <Not Part Of Certificate>
Validity Period:
Issued On Tuesday, March 1, 2022 at 5:24:42 PM
Expires On Monday, May 30, 2022 at 6:24:41 PM
Fingerprints:
SHA-256 Fingerprint 4F 09 0A 4B B3 83 EF CD 48 92 80 15 9E 21 25 B3
04 B5 54 A3 F1 06 52 BA 99 F1 0E B0 36 13 DD 40
SHA-1 Fingerprint 7C E2 08 BC 40 8D 14 9E E1 9D 00 C6 BD 18 47 30
BA 53 A0 67
We're seeing this issue in Python apps where I work.
To reproduce, this fails:
from urllib.request import urlopen
API_URL = "https://www.boredapi.com/api/activity"
with urlopen(API_URL) as response:
result = response.read()
print(result)
With this traceback:
Traceback (most recent call last):
File "/opt/Python-3.10.3/Lib/urllib/request.py", line 1348, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/opt/Python-3.10.3/Lib/http/client.py", line 1282, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/opt/Python-3.10.3/Lib/http/client.py", line 1328, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/opt/Python-3.10.3/Lib/http/client.py", line 1277, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/opt/Python-3.10.3/Lib/http/client.py", line 1037, in _send_output
self.send(msg)
File "/opt/Python-3.10.3/Lib/http/client.py", line 975, in send
self.connect()
File "/opt/Python-3.10.3/Lib/http/client.py", line 1454, in connect
self.sock = self._context.wrap_socket(self.sock,
File "/opt/Python-3.10.3/Lib/ssl.py", line 512, in wrap_socket
return self.sslsocket_class._create(
File "/opt/Python-3.10.3/Lib/ssl.py", line 1070, in _create
self.do_handshake()
File "/opt/Python-3.10.3/Lib/ssl.py", line 1341, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/daniel/junk/cert/main.py", line 5, in <module>
with urlopen(API_URL) as response:
File "/opt/Python-3.10.3/Lib/urllib/request.py", line 216, in urlopen
return opener.open(url, data, timeout)
File "/opt/Python-3.10.3/Lib/urllib/request.py", line 519, in open
response = self._open(req, data)
File "/opt/Python-3.10.3/Lib/urllib/request.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/opt/Python-3.10.3/Lib/urllib/request.py", line 496, in _call_chain
result = func(*args)
File "/opt/Python-3.10.3/Lib/urllib/request.py", line 1391, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File "/opt/Python-3.10.3/Lib/urllib/request.py", line 1351, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)>
It works fine if you change https
to http
in the URL though:
from urllib.request import urlopen
API_URL = "http://www.boredapi.com/api/activity"
with urlopen(API_URL) as response:
result = response.read()
print(result)
b'{"activity":"Write a short story","type":"recreational","participants":1,"price":0,"link":"","key":"6301585","accessibility":0.1}'
Would also like to know if this will be fixed?
When I try to use http, I get an error saying the content must be served over https. I don't know if it's just my computer or my mistakes, but is there a way I can fix this or work around it?
@abbieruth are you using HTTPS in the browser and then trying to make an Ajax/Fetch request with HTTP? That would cause an issue. If your server allows it, you could change the URL in your browser to HTTP and then any request with HTTP should work.
Yep, that's the problem. That explains why it works when I open it from my code editor but not on the hosted version. I hosted it through Netlify and all their websites and apps are https by default. Thank you for catching that!
By the way, your api is really cool!
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Thu, Jun 30, 2022 at 4:13 AM Daniel Schroeder @.***> wrote:
@abbieruth https://github.com/abbieruth are you using HTTPS in the browser and then trying to make an Ajax/Fetch request with HTTP? That would cause an issue. If your server allows it, you could change the URL in your browser to HTTP and then any request with HTTP should work.
— Reply to this email directly, view it on GitHub https://github.com/drewthoennes/Bored-API/issues/61#issuecomment-1170908369, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARGABBMOTFAS7OVRQN7EXA3VRVJK7ANCNFSM5XO64AKQ . You are receiving this because you were mentioned.Message ID: @.***>
Is there any chance of this getting fixed? Using sites with https requirements so I'm stuck and sad :(
Is there a chance that the expired certificate would be renewed? Thanks
It would be nice if the certificate would be renewed, it expired 58 days ago
@drewthoennes, please renew the certificate for https://www.boredapi.com/. Your API has a lot of fans and users. Thanks!