Browse Source

connection to JSON server adapter

master
Volker Birk 1 year ago
parent
commit
145dbd8c27
4 changed files with 40 additions and 3 deletions
  1. +33
    -0
      pEp_JSON.py
  2. +4
    -2
      pEp_import.py
  3. +0
    -1
      platform_macOS.py
  4. +3
    -0
      unix.py

+ 33
- 0
pEp_JSON.py View File

@ -0,0 +1,33 @@
# coding=UTF-8
import sys
import os
import json
from httplib import HTTPConnection
if sys.platform == 'darwin':
from platform_macOS import *
elif sys.platform == 'win32':
from platform_Windows import *
elif sys.platform == 'linux':
from platform_Linux import *
else:
sys.stderr.write("platform not supported\n")
sys.exit(1)
class Connection:
def __init__(self):
filename = os.path.join(per_user_directory, 'json-token')
self.config = json.load(file(filename))
def __enter__(self):
self.http_connection = HTTPConnection(str(self.config[u'address']), int(self.config[u'port']))
def __exit__(self, type, value, traceback):
self.http_connection.close()

+ 4
- 2
pEp_import.py View File

@ -6,10 +6,12 @@
import sys
import enigmail
import pEp_JSON
own_pgp_keys = enigmail.own_pgp_keys()
identities = enigmail.identities()
for key in enigmail.pubkey_iterator():
print identities
with pEp_JSON.Connection() as connect:
pass

+ 0
- 1
platform_macOS.py View File

@ -6,4 +6,3 @@ from unix import *
thunderbird_base = environ['HOME'] + '/Library/Thunderbird'

+ 3
- 0
unix.py View File

@ -3,6 +3,7 @@
from thunderbird import enigmail_agentPath
from common import which, GnuPGNotFound
from os import environ
def gpg_executable(thunderbird_base):
@ -14,3 +15,5 @@ def gpg_executable(thunderbird_base):
else:
return gpg
per_user_directory = environ['HOME'] + '/.pEp'

Loading…
Cancel
Save