Coder Social home page Coder Social logo

reminder's People

Watchers

 avatar

reminder's Issues

/usr/lib/python3.6/socket.py TimeoutError: [Errno 110] Connection timed out

When using with Amazon AWS EC2 or Lightsail, suddenly reminder stopped sending emails.

The log is:

Traceback (most recent call last):
  File "/home/ubuntu/reminder/reminder.py", line 57, in <module>
    server = smtplib.SMTP(host)
  File "/usr/lib/python3.6/smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python3.6/smtplib.py", line 336, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python3.6/smtplib.py", line 307, in _get_socket
    self.source_address)
  File "/usr/lib/python3.6/socket.py", line 724, in create_connection
    raise err
  File "/usr/lib/python3.6/socket.py", line 713, in create_connection
    sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

It looks like somewhere between 26/01/20 and 01/02/20 Amazon improved their firewall? and the connection sequence previously used between EC2 / Lightsail and Amazon SES no longer works.
It works from outside AWS though.

refactoring: delete extra variables

reminder/reminder.py

Lines 9 to 12 in 5a0daf6

join_paths = (str(Path(__file__).parent), "/config")
join_paths_list = (str(Path(__file__).parent), "/list.markdown")
config_path = "".join(join_paths)
list_path = "".join(join_paths_list)

this can be reduced to 2 lines

reminder/tasks.py

Lines 6 to 7 in 5a0daf6

join_paths_list = (str(Path(__file__).parent), "/list.markdown")
list_path = "".join(join_paths_list)

and this - to 1 line

refactoring: use line.startstwith()

reminder/reminder.py

Lines 25 to 33 in 5a0daf6

if row[0:5] == today:
# Append onetime and yearly tasks
tasks.append(row)
if row[0:5] == day + ".XX":
# Append monthly tasks
tasks.append(row)
if row[0:5] == weekday:
# Append weekly tasks
tasks.append(row)

this can be improved

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.