Compare commits
No commits in common. "master" and "download_bug" have entirely different histories.
master
...
download_b
2 changed files with 19 additions and 29 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
FROM python:3.8-slim
|
FROM python:3.8
|
||||||
|
|
||||||
RUN pip install ofxparse
|
RUN pip install ofxparse
|
||||||
RUN pip install watchdog
|
RUN pip install watchdog
|
||||||
|
|
|
||||||
12
converter.py
12
converter.py
|
|
@ -134,10 +134,9 @@ class Handler(watchdog.events.PatternMatchingEventHandler):
|
||||||
|
|
||||||
fileExists = False
|
fileExists = False
|
||||||
timeout = 0
|
timeout = 0
|
||||||
|
|
||||||
while not fileExists:
|
while not fileExists:
|
||||||
fileExists = os.path.isfile(event.src_path)
|
fileExists = os.path.isfile(event.src_path)
|
||||||
time.sleep(5)
|
time.sleep(1)
|
||||||
timeout += 1
|
timeout += 1
|
||||||
|
|
||||||
if timeout > 60:
|
if timeout > 60:
|
||||||
|
|
@ -153,7 +152,6 @@ class Handler(watchdog.events.PatternMatchingEventHandler):
|
||||||
logging.info("file copy has now finished")
|
logging.info("file copy has now finished")
|
||||||
|
|
||||||
with open(event.src_path, 'r') as file:
|
with open(event.src_path, 'r') as file:
|
||||||
try:
|
|
||||||
qfx = OfxParser.parse(file, fail_fast=False)
|
qfx = OfxParser.parse(file, fail_fast=False)
|
||||||
statement, acct_name = Handler.get_statement_from_qfx(qfx)
|
statement, acct_name = Handler.get_statement_from_qfx(qfx)
|
||||||
|
|
||||||
|
|
@ -177,17 +175,9 @@ class Handler(watchdog.events.PatternMatchingEventHandler):
|
||||||
|
|
||||||
if not destination.exists():
|
if not destination.exists():
|
||||||
path.replace(destination)
|
path.replace(destination)
|
||||||
except:
|
|
||||||
logging.info("Failed to process {}".format(event.src_path))
|
|
||||||
|
|
||||||
logging.info("Processing successfully finished for {}".format(event.src_path))
|
logging.info("Processing successfully finished for {}".format(event.src_path))
|
||||||
|
|
||||||
def on_modified(self, event):
|
|
||||||
logging.info('Found modified file: {}'.format(event.src_path))
|
|
||||||
self.on_created(event)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
event_handler = Handler()
|
event_handler = Handler()
|
||||||
observer = watchdog.observers.Observer()
|
observer = watchdog.observers.Observer()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue