This app will shorten a long URL using the Goo.gl service. It requires an OAuth token in order to associate its requests with your Google account so that you can log into goo.gl and view the URL analytics.
prerequisites & installation
- A Google account
- Install the Google Python library
pip install --upgrade google-api-python-client
- Go to the Google Developer Console and enable the URL Shortener API
- Create OAuth2 client credentials for the app. For Application Type choose Other.
- Now that you have a client ID and secret, populate the
client_secrets.jsonfrom step 1 with those values. The other 3 keys can be left as is.
That should be it, go ahead and run shorten-url.py and happy URL shortening.
*During the first run you'll be prompted authorize the app, just follow the instructions as it should be pretty self explanatory.