diff --git a/src/gam.py b/src/gam.py index f11be94b..cad892b8 100755 --- a/src/gam.py +++ b/src/gam.py @@ -7613,9 +7613,11 @@ class ShortURLFlow(google_auth_oauthlib.flow.InstalledAppFlow): url_shortnr = 'https://gam-shortn.appspot.com/create' headers = {'Content-Type': 'application/json'} try: - _, content = simplehttp.request(url_shortnr, 'POST', '{"long_url": "%s"}' % long_url, headers=headers) + resp, content = simplehttp.request(url_shortnr, 'POST', '{"long_url": "%s"}' % long_url, headers=headers) except: return long_url, state + if resp.status != 200: + return long_url, state return json.loads(content).get('short_url', ''), state def _run_oauth_flow(client_id, client_secret, scopes, access_type, login_hint=None):