Skip to content

Commit 3caf5d0

Browse files
Merge pull request #136 from pranavbaburaj/master
feat:Change according to #135
2 parents a7559fc + c612628 commit 3caf5d0

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/arguments/search.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ def __init__(self, message):
1919
def prompt(self):
2020
print(colored(f"{self.message} : ", 'cyan'), end='')
2121
data = input()
22-
if data == "":
23-
SearchError("\U0001F613 Input data empty",
24-
"\U0001F504 Please try again ")
25-
sys.exit()
26-
else:
27-
return str(data)
22+
return data
2823

2924

3025
class Search():
@@ -71,12 +66,18 @@ def search_for_results(self, save=False):
7166
# KeyBoard Interrupts or EOErrors
7267
try:
7368
prompt = Prompt(str(each_query)).prompt()
69+
if each_query == "Tags":
70+
continue
71+
if prompt.strip() == "":
72+
SearchError("\U0001F613 Input data empty",
73+
"\U0001F504 Please try again ")
74+
sys.exit()
7475
except:
7576
sys.exit()
7677

7778
query_solutions.append(prompt)
7879

79-
question, tags = query_solutions[0], query_solutions[1]
80+
question, tags = query_solutions[0], query_solutions[1] if len(query_solutions) > 1 else ""
8081
json_output = self.utility_object.make_request(question, tags)
8182
questions = self.utility_object.get_que(json_output)
8283
if questions == []:

src/arguments/utility.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ def make_request(self, que, tag: str):
336336
"""
337337
with console.status("Searching..."):
338338
try:
339-
resp = requests.get(self.__get_search_url(que, tag))
339+
url = self.__get_search_url(que, tag)
340+
resp = requests.get(url)
340341
except:
341342
SearchError("\U0001F613 Search Failed",
342343
"\U0001F4BB Try connecting to the internet")

0 commit comments

Comments
 (0)