dupeguru/hscommon/error_report.py

24 lines
704 B
Python
Raw Normal View History

# 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
def send_error_report(text):
def do():
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)
threading.Thread(target=do).start()