From 6f2ae839f5fbd17f0667e8727f9aa5c8f7571de5 Mon Sep 17 00:00:00 2001 From: Fuhrmann Date: Wed, 22 Apr 2020 17:29:53 -0300 Subject: [PATCH] Remove google from the list of services --- README.md | 10 ++++++---- src/services/google.py | 16 ---------------- src/urlshortener.ini | 13 +++---------- src/urlshortener.py | 5 +---- 4 files changed, 10 insertions(+), 34 deletions(-) delete mode 100644 src/services/google.py diff --git a/README.md b/README.md index b42cc3b..80ff13d 100644 --- a/README.md +++ b/README.md @@ -43,9 +43,9 @@ Open Keypirinha and type 'URL Shortener'. There are three catalog items implemen ``` # Here you can specify the main service used to shorten the url -# Accepted values: google, tinyurl, isgood, bitly -# * Default: google -main_service = google +# Accepted values: tinyurl, isgood, bitly +# * Default: tinyurl +main_service = tinyurl # Enabling history will allow you to see all your shortened urls # * Default: yes @@ -53,12 +53,14 @@ enable_history=yes ``` ## Suported services -- **Google (default, http://goo.lg)** - This plugin already ships with a Google URL Shortener API key. This is my own personal key. All short URLs are public. You are not required, but you can create your own API KEY if for some reason this service stop working. - **TinyURL (http://tinyurl.com)** - No further configuration necessary. - **is.gd (http://is.gd)** - No further configuration necessary. - **Bitly (http://bit.ly)** - An API key is required. Generate an API KEY on [bit.ly's website](https://bitly.com/a/oauth_apps). ## Change Log +### v1.1 +* Remove google from the list of services + ### v1.0 * Released diff --git a/src/services/google.py b/src/services/google.py deleted file mode 100644 index 35bd605..0000000 --- a/src/services/google.py +++ /dev/null @@ -1,16 +0,0 @@ -import json - -from .service import Service - - -class Google(Service): - - def shorten(self, url): - post_data = json.dumps({'longUrl': url}).encode('utf-8') - data = self.post_request(post_data) - url_shortened = data['id'] - - return url_shortened - - def formatted_api_url(self): - return "{}{}".format(self.api_url, self.api_key) diff --git a/src/urlshortener.ini b/src/urlshortener.ini index 9893ace..88c946b 100644 --- a/src/urlshortener.ini +++ b/src/urlshortener.ini @@ -4,21 +4,14 @@ [main] # Here you can specify the main service used to shorten the url -# Accepted values: google, tinyurl, isgood, bitly -# * Default: google -main_service=google +# Accepted values: tinyurl, isgood, bitly +# * Default: tinyurl +main_service=tinyurl # Enabling history will allow you to see all your shortened urls # * Default: yes enable_history=yes -# The URL used by Google's service -# Generate your api key by accessing: https://console.developers.google.com/apis/credentials -# The API_KEY is required. -[google] -API_URL = https://www.googleapis.com/urlshortener/v1/url?key= -API_KEY = AIzaSyD_6wZK9xkE8JtJqzNGPgrLmWVqgqz4SEA - # The URL used by TinyURL's service [tinyurl] API_URL = http://tinyurl.com/api-create.php?url= diff --git a/src/urlshortener.py b/src/urlshortener.py index 501f9cf..2f65a8e 100644 --- a/src/urlshortener.py +++ b/src/urlshortener.py @@ -11,10 +11,8 @@ from .history import History from .services.bitly import Bitly from .services.goodis import GoodIs -from .services.google import Google from .services.tinyurl import TinyURL - class URLShortener(kp.Plugin): # The keypirinha's category that represents a shortened URL ITEM_URL = kp.ItemCategory.USER_BASE + 1 @@ -22,14 +20,13 @@ class URLShortener(kp.Plugin): # The keypirinha's category that represents a entry in the user's history ITEM_HISTORY = kp.ItemCategory.USER_BASE + 2 services = { - 'google': Google, 'tinyurl': TinyURL, 'isgood': GoodIs, 'bitly': Bitly, } # Default service used to shorten urls - DEFAULT_MAIN_SERVICE = 'google' + DEFAULT_MAIN_SERVICE = 'tinyurl' def __init__(self): super().__init__()