Not able to access APIs after running certbot

I’m installing a server for my website, using nginx. I need to run a script on the same server that tries to access the google translate api (python library googletrans) which uses HTTP/2.
It worked but once I ran certbot to get SSL I can no longer access the API.

The commands I ran are:
sudo certbot --nginx
certbot certonly --cert-name -d -d

My nginx config file is:
server {

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/me/mysite/website;

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/me/mysite/website/website.sock;

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

server {
    if ($host = {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    return 404; # managed by Certbot

The script I’m using to test my access to the API is:
from googlestrans import Translator
t = Translator()

Which gives me a 503 python error

OS: Ubuntu 16.04

Hi @joshbindels,

Are you saying that your script can't run at all now or that your script runs, but gives an error from Google at the moment it tries to connect to the Google API? In other words, are you seeing a 503 error from your nginx, or from Google's API?

I’m getting a 503 from google’s API

Do you also see that if you run your script on the command line or in an interactive Python interpreter? Do you have to have a particular API key or credential in order to access this API?

Yes I get the same issue when I use the interactive interpeter.
The library I’m using makes it so I don’t need credentials.

It was working before I ran certbot, but after it just doesn’t seem to go through

I think this is very likely to be a coincidence because I don’t think Certbot would change anything that affects the success of this API request. Can you get any other debugging information from the API about why the request was rejected?

This is the message of the HTML response the API gets, I suppose it’s just an issue with the serve and like you said it was a coincidence that it worked before, or it just had a very limited number of times it could work.

<script src="" async defer></script>

<b>About this page</b><br><br>Our systems have detected unusual traffic from your compu$
er network.  This page checks to see if it&#39;s really you sending the requests, and n$
t a robot. Why did this happen?</a><br><br>

This page appears when Google automatically detects requests coming from your computer $etwork which appear to be in violation of the. The block will expire shortly after those requests stop.  In the
meantime, solving the above CAPTCHA will let you continue to use our services.<br><br>T$is traffic may have been sent by malicious software, a browser plug-in, or a script tha$ sends automated requests.  If you share your network connection, ask your administrator
 for help &mdash; a different computer using the same IP address may be responsible. 
 Sometimes you
may be asked to solve the CAPTCHA if you are using advanced terms that robots are known
to use, or sending requests very quickly.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.