Conversation
mxnet-bot/EmailBot/EmailBot.py
Outdated
# Send emails using Amazon Simple Email Service(SES) | ||
# Sender's email address must be verified. | ||
# Replace it with sender's email address | ||
sender = "sender@email.com" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also set this as an Environment Variable
instead of dig into the code and fix it?
Does the user required to use Gmail to send Email, can MS Email also using the same tool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, every email address verified in SES can use this tool
mxnet-bot/EmailBot/EmailBot.py
Outdated
sender = "sender@email.com" | ||
# Recipients' email address must be verified | ||
# Replace it with recipients' email addresses | ||
recipients = ["recipient1@email.com", "recipient2@email.com"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same applies to here, can user define them outside? How about storing them into a json
file and then use the code to load these information?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Store information in a json file is approachable
mxnet-bot/EmailBot/EmailBot.py
Outdated
# Replace it with recipients' email addresses | ||
recipients = ["recipient1@email.com", "recipient2@email.com"] | ||
# If necessary, replace us-west-2 with the AWS Region you're using for Amazon SES. | ||
aws_region = "us-west-2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same concerns mentioned above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
return 1 | ||
# response.headers['link'] will looks like: | ||
# <https://api.github.com/repositories/34864402/issues?state=all&page=387>; rel="last" | ||
# In this case we need to extrac '387' as the count of pages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract
@CathyZhang0822 test test |
@haojin2 Test added, review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work Cathy!
Added a few comments:
- Remove extra empty lines from all files.
- Add docstring comment at the top of file mentioning usage of that particular file.
mxnet-bot/EmailBot/EmailBot.py
Outdated
logging.getLogger('botocore').setLevel(logging.CRITICAL) | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove empty lines
mxnet-bot/EmailBot/EmailBot.py
Outdated
|
||
|
||
class EmailBot: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
mxnet-bot/EmailBot/EmailBot.py
Outdated
# Replace it with recipients' email addresses | ||
recipients = ["recipient1@email.com", "recipient2@email.com"] | ||
# If necessary, replace us-west-2 with the AWS Region you're using for Amazon SES. | ||
aws_region = "us-west-2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
mxnet-bot/EmailBot/EmailBot.py
Outdated
self.end = datetime.datetime.today()+datetime.timedelta(days=2) | ||
|
||
def __clean_string(self, raw_string, sub_string): | ||
# covert all non-alphanumeric characters from raw_string to sub_string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*convert
# In this case we need to extrac '387' as the count of pages | ||
return int(self.__clean_string(response.headers['link'], " ").split()[-3]) | ||
|
||
def read_repo(self, periodically=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add method description in comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. All methods descriptions are added.
mxnet-bot/EmailBot/EmailBot.py
Outdated
non_responded += [{k: v for k, v in item.items() | ||
if k in ['number', 'html_url', 'title']}] | ||
non_responded_urls = non_responded_urls + url | ||
if (datetime.datetime.strptime("2018-05-15", "%Y-%m-%d") < created |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep sla_start_date variable in class then, use that variable everywhere instead
mxnet-bot/EmailBot/README.md
Outdated
* [Verify Email Addresses](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses-procedure.html) Go to AWS console -> SES -> Email Addresses to verify email address. Then fill in `sender` and `recipients` in `EmailBot.py`. | ||
* Test the Lambda Function. On the lambda function's console, click Test. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these extra lines
@@ -0,0 +1,25 @@ | |||
# MXNet Bot | |||
This is a directory contains bots served to improve operational efficiency. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*This directory contains bots served to improve operational efficiency.
## Label Bot | ||
This bot will help automate/simplify issue labeling process, which mainly contains 3 parts: | ||
* Machine Learning part: | ||
A web server built based on AWS Elastic Beanstalk which can response to GET/POST requests and realize self-maintenance. It mainly has 2 features: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add link to "AWS Elastic Beanstalk"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
1. Set constructor arguments for EmailBot class 2. Automate deployment process 3. Improve coding style 4. Edit README
Description
An email bot which can automatically send daily GitHub issue reports using Amazon Simple Email Service and AWS Lambda.
@lanking520 @Roshrini
@nswamy @marcoabreu @eric-haibin-lin
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.