-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added custom query function and option/features class
- Loading branch information
1 parent
0a9790c
commit 97cfbf8
Showing
3 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
''' | ||
Authors: Elijah Sawyers, Benjamin Sanders | ||
Emails: elijahsawyers@gmail.com, ben.sanders97@gmail.com | ||
Date: 07/29/2019 | ||
Overview: Contains various extra features and options. | ||
''' | ||
|
||
from .features import custom_query |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
''' | ||
Authors: Elijah Sawyers, Benjamin Sanders | ||
Emails: elijahsawyers@gmail.com, ben.sanders97@gmail.com | ||
Date: 07/29/2019 | ||
Overview: Contains extra features for autostack. | ||
''' | ||
|
||
from __future__ import print_function | ||
from autostack.web_scraper.stack_overflow_scraper import ( | ||
accepted_posts, | ||
print_accepted_post | ||
) | ||
|
||
def custom_query(): | ||
''' | ||
Allows the user to submit a custom query to search on Stack Overflow. | ||
''' | ||
|
||
print('Enter a custom query: ', end='') | ||
new_query = input() | ||
|
||
for post in accepted_posts(new_query): | ||
# Display Stack Overflow posts for the error. | ||
print_accepted_post(post) | ||
|
||
# If the user's question has been answered, | ||
# don't keep looping over posts. | ||
while True: | ||
print('Did this answer your question? (Y/n): ', end='') | ||
question_answered = input() | ||
if question_answered == 'Y' or question_answered == 'n': | ||
break | ||
if question_answered == 'Y': | ||
print(u'\U0001F95E Listening for Python errors...') | ||
break | ||
elif question_answered == 'n': | ||
continue |