You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying out CodeRed for the first time, and getting inconsistent behavior between several projects I was deploying. I finally narrowed it down to cr working in 3.12 environments, and failing in 3.13 environments.
This is on macOS, using zsh, but I think this is an issue relating to the use of urlopen() in cr/api.py. In 3.13, urlopen()no longer accepts a cafile argument. I got it to work by modifying request_json() in api.py, but it's just a demo; I'm not sure the best place to put that change, or if I used the best approach.
Reproduction
Here's a 3.12 session that makes a cr check call against a fake project, returning the expected Error: No Webapp matches the given query. A 3.13 session with the same call generates an API error.
In the 3.13 venv, I made the following change in api.py and the cr check call worked.
defrequest_json(
...
) ->Tuple[int, dict]:
""" Makes an HTTP request and parses the JSON response. """
...
# Open the request and read the response.importsslcontext=ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.load_verify_locations(cafile=certifi.where())
try:
r=urlopen(req, timeout=timeout, context=context)
...
exceptHTTPErroraserr:
...
return (code, d)
(cr_cli_test) ~/test_code/cr_cli_test$ python -V
Python 3.13.1
(cr_cli_test) ~/test_code/cr_cli_test$ cr check fake-project
Error: No Webapp matches the given query.
Thanks Eric! We haven't tested cr in 3.13, which was a bit of a miss because we did just add 3.13 support on CodeRed Cloud a few weeks go. Anecdotally most people seem to be using the binary in their day-to-day (myself included). Thanks for the fix, I'll get this merged in.
I was trying out CodeRed for the first time, and getting inconsistent behavior between several projects I was deploying. I finally narrowed it down to
cr
working in 3.12 environments, and failing in 3.13 environments.This is on macOS, using zsh, but I think this is an issue relating to the use of
urlopen()
in cr/api.py. In 3.13,urlopen()
no longer accepts acafile
argument. I got it to work by modifyingrequest_json()
in api.py, but it's just a demo; I'm not sure the best place to put that change, or if I used the best approach.Reproduction
Here's a 3.12 session that makes a
cr check
call against a fake project, returning the expectedError: No Webapp matches the given query.
A 3.13 session with the same call generates an API error.The text was updated successfully, but these errors were encountered: