Merge pull request #19 from ggiesen/master

Make bw_add_sshkeys Python 3.6-compatible
This commit is contained in:
Joao Jacome 2021-11-23 15:36:35 +00:00 committed by GitHub
commit 55c9342c04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,7 +36,7 @@ def bwcli_version():
proc_version = subprocess.run( proc_version = subprocess.run(
['bw', '--version'], ['bw', '--version'],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
text=True, universal_newlines=True,
check=True, check=True,
) )
return proc_version.stdout return proc_version.stdout
@ -78,7 +78,7 @@ def get_session():
proc_session = subprocess.run( proc_session = subprocess.run(
['bw', '--raw', operation], ['bw', '--raw', operation],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
text=True, universal_newlines=True,
check=True, check=True,
) )
return proc_session.stdout return proc_session.stdout
@ -93,7 +93,7 @@ def get_folders(session, foldername):
proc_folders = subprocess.run( proc_folders = subprocess.run(
['bw', 'list', 'folders', '--search', foldername, '--session', session], ['bw', 'list', 'folders', '--search', foldername, '--session', session],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
text=True, universal_newlines=True,
check=True, check=True,
) )
@ -120,7 +120,7 @@ def folder_items(session, folder_id):
proc_items = subprocess.run( proc_items = subprocess.run(
[ 'bw', 'list', 'items', '--folderid', folder_id, '--session', session], [ 'bw', 'list', 'items', '--folderid', folder_id, '--session', session],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
text=True, universal_newlines=True,
check=True, check=True,
) )
return json.loads(proc_items.stdout) return json.loads(proc_items.stdout)
@ -176,7 +176,7 @@ def ssh_add(session, item_id, key_id):
'--session', session '--session', session
], ],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
text=True, universal_newlines=True,
check=True, check=True,
) )
ssh_key = proc_attachment.stdout ssh_key = proc_attachment.stdout
@ -189,7 +189,7 @@ def ssh_add(session, item_id, key_id):
input=ssh_key, input=ssh_key,
# Works even if ssh-askpass is not installed # Works even if ssh-askpass is not installed
env=dict(os.environ, SSH_ASKPASS_REQUIRE="never"), env=dict(os.environ, SSH_ASKPASS_REQUIRE="never"),
text=True, universal_newlines=True,
check=True, check=True,
) )