python-github-backup icon indicating copy to clipboard operation
python-github-backup copied to clipboard

Calls always timing out

Open jstetic opened this issue 6 years ago • 4 comments

I was having an issue running the code. It's was a silly system config error I ran into on a new dev environment. Since code throws a misleading I'm putting the issue here in case other people happen to have the issue.

TLDR:

If you keep seeing this

https://api.github.com/user timed out
https://api.github.com/user timed out
https://api.github.com/user timed out
https://api.github.com/user timed out

but know you are connected to the network

Then run

cd /Applications/Python\ 3.7/
./Install\ Certificates.command

(change 3.7 to whatever version of python 3 you are using)

More detail:

Python 3.7 does not rely on MacOS' openSSL anymore. It comes with its own openSSL bundled and doesn't have access on MacOS' root certificates.

in _get_response() the detail of the URLError is swallowed up, and leads you to believe you call is timing out

except URLError:
            should_continue = _request_url_error(template, retry_timeout)
            if not should_continue:
                raise

I logged the error

except URLError as e:
            log_error(e.reason)
            should_continue = _request_url_error(template, retry_timeout)
            if not should_continue:
                raise

and saw [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed I ran the above commands and everything is working

Thanks to the post here that set me straight https://stackoverflow.com/questions/40684543/how-to-make-python-use-ca-certificates-from-mac-os-truststore

jstetic avatar Feb 15 '19 06:02 jstetic

What was the misleading output?

josegonzalez avatar Feb 15 '19 06:02 josegonzalez

The output said timed out, when actually the request never had the chance to timeout because CERTIFICATE_VERIFY_FAILED failed. The root cause was a crummy environment set up on my side, it just took me a little bit to find the issue because the error shown was "timeout" rather than the more detailed CERTIFICATE_VERIFY_FAILED.

BTW great tool - thanks for building it @josegonzalez . worked great for me. I made a few mods to it to also use it for issue export to CSV across repos.

jstetic avatar Feb 15 '19 17:02 jstetic

Can you make a pull request with the logging change so this might help other users in the future?

josegonzalez avatar Feb 15 '19 17:02 josegonzalez

will do soon as a I get a chance over the next few days.

jstetic avatar Feb 15 '19 19:02 jstetic