2014-01-26 20:03:24 +00:00
|
|
|
# Created By: Virgil Dupras
|
|
|
|
# Created On: 2014-01-26
|
|
|
|
# Copyright 2014 Hardcoded Software (http://www.hardcoded.net)
|
|
|
|
#
|
|
|
|
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
|
|
|
# which should be included with this package. The terms are also available at
|
|
|
|
# http://www.hardcoded.net/licenses/bsd_license
|
|
|
|
|
|
|
|
import ftplib
|
|
|
|
import io
|
|
|
|
import time
|
|
|
|
import threading
|
2014-01-26 20:27:02 +00:00
|
|
|
import logging
|
2014-01-26 20:03:24 +00:00
|
|
|
|
|
|
|
def send_error_report(text):
|
|
|
|
def do():
|
2014-01-26 20:27:02 +00:00
|
|
|
try:
|
|
|
|
conn = ftplib.FTP('drop.hardcoded.net')
|
|
|
|
conn.login()
|
|
|
|
conn.cwd('/drop')
|
|
|
|
textfp = io.BytesIO(text.encode('utf-8'))
|
|
|
|
cmd = 'STOR report%d.txt' % time.time()
|
|
|
|
conn.storbinary(cmd, textfp)
|
|
|
|
except Exception as e:
|
|
|
|
logging.warning("Couldn't send error report: %s", e)
|
2014-01-26 20:03:24 +00:00
|
|
|
|
|
|
|
threading.Thread(target=do).start()
|