Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuhrmann committed Mar 7, 2018
1 parent a695596 commit 8365df9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Binary file modified build/Lipsum.keypirinha-package
Binary file not shown.
13 changes: 6 additions & 7 deletions src/lipsum.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,16 @@ def _fetch_text(self, type, ammount, start):
opener = kpnet.build_urllib_opener()

headers = []
headers.append(
('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'))
headers.append(('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'))
opener.addheaders = headers[:]

request = opener.open(
self.LOREM_IPSUM_API + "?amount=" + ammount + "&start=" + start + "&what=" + type)
response = request.read().decode(encoding="utf-8", errors="strict")
with opener.open(self.LOREM_IPSUM_API + "?amount=" + ammount + "&start=" + start + "&what=" + type) as request:
response = request.read().decode(encoding="utf-8", errors="strict")

data = json.loads(response)
return data['feed']['lipsum']
except:
return "loripsum.net website could not be reached!"
return "lipsum.com website could not be reached!"

# Search for a number in a string
def _search_number(self, text):
Expand Down Expand Up @@ -112,7 +111,7 @@ def _set_default_actions(self):
self.create_action(name="yes", label="Yes",
short_desc="Start with 'Lorem Ipsum...'"),
self.create_action(name="no", label="No",
short_desc="Start with 'Lorem Ipsum...'")
short_desc="Dont start with 'Lorem Ipsum...'")
])


Expand Down

0 comments on commit 8365df9

Please sign in to comment.