diff --git a/motioneye/uploadservices.py b/motioneye/uploadservices.py index 8047fd6d5..3250e48bb 100644 --- a/motioneye/uploadservices.py +++ b/motioneye/uploadservices.py @@ -14,7 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from base64 import b64encode import datetime import ftplib import io @@ -27,6 +26,7 @@ import urllib.error import urllib.parse import urllib.request +from base64 import b64encode import boto3 import pycurl @@ -860,7 +860,7 @@ def __init__(self, camera_id): def _request(self, url, method, body=None): base64string = b64encode(f'{self._username}:{self._password}') - headers = { 'Authorization' : 'Basic %s' % base64string } + headers = {'Authorization': 'Basic %s' % base64string} if body is not None: headers.update('Content-Length', '%d' % len(body)) self.debug('request: ' + method + ' ' + url) @@ -870,7 +870,9 @@ def _request(self, url, method, body=None): utils.urlopen(request) except urllib.HTTPError as e: if method == 'MKCOL' and e.code == 405: - self.debug('MKCOL failed with code 405, this is normal if the folder exists') + self.debug( + 'MKCOL failed with code 405, this is normal if the folder exists' + ) else: raise e @@ -894,7 +896,7 @@ def upload_data(self, filename, mime_type, data, ctime, camera_name): path = self._location.strip('/') + '/' + os.path.dirname(filename) + '/' filename = os.path.basename(filename) self._make_dirs(path) - self.debug('uploading %s of %s bytes' % (filename, len(data))) + self.debug(f'uploading {filename} of {len(data)} bytes') self._request(self._server + path + filename, 'PUT', bytearray(data)) self.debug('upload done') @@ -903,7 +905,7 @@ def dump(self): 'server': self._server, 'username': self._username, 'password': self._password, - 'location': self._location + 'location': self._location, } def load(self, data):