Skip to content

Commit 235e3eb

Browse files
author
yasht01
committed
Add command line argument for GET request
1 parent e6a1521 commit 235e3eb

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
help="Check updates for the application",
4747
action="store_true")
4848

49+
parser.add_argument("-GET",
50+
help="Make a GET request to an API",
51+
action='store_true')
52+
4953
ARGV = parser.parse_args()
5054

5155
search_flag = Search(ARGV)

src/arguments/search.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from .utility import Utility
99
from .save import SaveSearchResults
1010
from .update import UpdateApplication
11+
from .api_test import Api_Testing
1112

1213
version = "0.1.0"
1314
class Prompt():
@@ -28,6 +29,7 @@ class Search():
2829
def __init__(self, arguments):
2930
self.arguments = arguments
3031
self.utility_object = Utility()
32+
self.api_test_object = Api_Testing()
3133

3234
def search_args(self):
3335
if self.arguments.search:
@@ -45,6 +47,8 @@ def search_args(self):
4547
elif self.arguments.update:
4648
update = UpdateApplication(version)
4749
update.check_for_updates()
50+
elif self.arguments.GET:
51+
self.api_test_object.get_request()
4852

4953
def search_for_results(self, save=False):
5054
queries = ["What do you want to search", "Tags"]
@@ -83,4 +87,4 @@ def search_for_results(self, save=False):
8387
filename = SaveSearchResults(data)
8488
print(
8589
colored(f"\U0001F604 Answers successfully saved into {filename}",
86-
"green"))
90+
"green"))

0 commit comments

Comments
 (0)