add function

This commit is contained in:
yumoqing 2019-09-16 15:11:14 +08:00
parent b9f6e47c55
commit d9fd408dd6
5 changed files with 19 additions and 9 deletions

View File

@ -1,6 +1,9 @@
import os
import sys
import appPublic.myjson as json
try:
import ujson as json
except:
import json
from jinja2 import Environment,FileSystemLoader
import codecs
from appPublic.argsConvert import ArgsConvert
@ -39,6 +42,7 @@ class MyTemplateEngine:
self.env.globals.update({k:v})
def _render(self,template,data):
# print('**********template=',template,'**data=',data,'type_data=',type(data),'************')
uRet = template.render(**data)
return uRet

View File

@ -32,14 +32,17 @@ class RSA:
text = pem.decode('utf8')
f.write(text)
def write_publickey(self,public_key,fname):
def publickeyText(self,public_key):
pem = public_key.public_bytes(
encoding=serialization.Encoding.PEM,
format=serialization.PublicFormat.SubjectPublicKeyInfo
)
text = pem.decode('utf8')
return text
def write_publickey(self,public_key,fname):
text = self.publickeyText(public_key)
with open(fname,'w') as f:
text = pem.decode('utf8')
f.write(text)
def read_privatekey(self,fname,password=None):
@ -167,4 +170,4 @@ if __name__ == '__main__':
x = r.encode(ypub,text)
ntext = r.decode(ypri,x)
print(text,'<==>',ntext)

View File

@ -1,6 +1,9 @@
from appPublic.rsa import RSA
from appPublic.rc4 import RC4
import ujson as json
try:
import ujson as json
except:
import json
import random
class DeliverPacket:
@ -122,4 +125,4 @@ Twisted 18.9.0 documentation » Twisted Names (DNS) » Developer Guides » '''
print('<===>')
print(c)
print('<===>')
print(newtxt)
print(newtxt)

View File

@ -53,7 +53,7 @@ def monthMaxDay(y,m):
def date2str(dt=None):
if dt is None:
dt = curDatetime()
return '%04d-%02d-%-02d' % (dt.year,dt.month,dt.day)
return '%04d-%02d-%02d' % (dt.year,dt.month,dt.day)
def time2str(dt):
return '%02d:%02d:%02d' % (dt.hour,dt,minute,dt.second)

View File

@ -9,7 +9,7 @@ from setuptools import setup, find_packages
# python setup.py bdist_egg generate a egg file
# Release information about eway
version = "5.0.18"
version = "5.1.1"
name = "appPublic"
description = "appPublic"
author = "yumoqing"