mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-05 05:11:35 +00:00
200 or bust for URL shorten
This commit is contained in:
@@ -7613,9 +7613,11 @@ class ShortURLFlow(google_auth_oauthlib.flow.InstalledAppFlow):
|
|||||||
url_shortnr = 'https://gam-shortn.appspot.com/create'
|
url_shortnr = 'https://gam-shortn.appspot.com/create'
|
||||||
headers = {'Content-Type': 'application/json'}
|
headers = {'Content-Type': 'application/json'}
|
||||||
try:
|
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:
|
except:
|
||||||
return long_url, state
|
return long_url, state
|
||||||
|
if resp.status != 200:
|
||||||
|
return long_url, state
|
||||||
return json.loads(content).get('short_url', ''), state
|
return json.loads(content).get('short_url', ''), state
|
||||||
|
|
||||||
def _run_oauth_flow(client_id, client_secret, scopes, access_type, login_hint=None):
|
def _run_oauth_flow(client_id, client_secret, scopes, access_type, login_hint=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user