mirror of
https://github.com/brmlab/brmdoor_libnfc.git
synced 2025-06-08 00:24:00 +02:00
Explicit UTF-8 encoding, flush temp file before upload
This commit is contained in:
parent
45aead62ad
commit
8fd2b47638
2 changed files with 4 additions and 3 deletions
|
@ -389,11 +389,12 @@ class SpaceAPIUploader(object):
|
||||||
spaceApiJson["state"] = {"open": True, "lastchange": time.time()}
|
spaceApiJson["state"] = {"open": True, "lastchange": time.time()}
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile() as tf:
|
with tempfile.NamedTemporaryFile() as tf:
|
||||||
json.dump(spaceApiJson, tf)
|
json.dump(spaceApiJson, tf, indent=4, ensure_ascii=True, encoding='utf-8')
|
||||||
|
tf.flush()
|
||||||
localFilename = tf.name
|
localFilename = tf.name
|
||||||
with pysftp.Connection(self.config.sftpHost, username=self.config.sftpUsername, port=self.config.sftpPort,
|
with pysftp.Connection(self.config.sftpHost, username=self.config.sftpUsername, port=self.config.sftpPort,
|
||||||
private_key=self.config.sftpKey) as sftp:
|
private_key=self.config.sftpKey) as sftp:
|
||||||
sftp.timeout = 30
|
sftp.timeout = 15
|
||||||
with sftp.cd(dirname):
|
with sftp.cd(dirname):
|
||||||
sftp.put(localFilename, remotepath=targetFname)
|
sftp.put(localFilename, remotepath=targetFname)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"logo": "https://brmlab.cz/brmlab.png",
|
"logo": "https://brmlab.cz/brmlab.png",
|
||||||
"url": "https://brmlab.cz/",
|
"url": "https://brmlab.cz/",
|
||||||
"location": {
|
"location": {
|
||||||
"address": "Pod Kaplickou 3149/18, 13000 Praha 3",
|
"address": "Pod Kapličkou 3149/18, 13000 Praha 3",
|
||||||
"lon": 50.08346,
|
"lon": 50.08346,
|
||||||
"lat": 14.48032
|
"lat": 14.48032
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue