Skip to content

Instantly share code, notes, and snippets.

@theukedge
Last active April 29, 2016 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theukedge/47edeceeb7f603c38256bbe712c70813 to your computer and use it in GitHub Desktop.
Save theukedge/47edeceeb7f603c38256bbe712c70813 to your computer and use it in GitHub Desktop.
request_url = "https://dave.pe/yourls-api.php?signature=xxxxxxxx&action=shorturl&format=json&url={}".format( input['article_url'] )
yourls_response = requests.get(request_url)
if yourls_response.status_code != 200:
status = "fail"
exit()
data = yourls_response.json()
shorturl = data["shorturl"]
return {
'shorturl': shorturl
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment