Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
Data-Generate-test
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
Data-Generate-test
Commits
c9da61e3
Commit
c9da61e3
authored
Sep 04, 2019
by
张鹏程
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加加密规则
parent
dd2f5a7a
Pipeline
#926
failed with stages
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
38 deletions
+34
-38
startup.py
startup.py
+20
-22
Untitled.ipynb
test/Untitled.ipynb
+9
-11
tools.py
utils/tools.py
+5
-5
No files found.
startup.py
View file @
c9da61e3
...
...
@@ -13,11 +13,14 @@ import config.settings as URL
from
handler
import
UserRegister_Handler
from
tornado.options
import
define
,
options
define
(
"port"
,
default
=
21000
,
help
=
"run on the given port "
,
type
=
int
)
define
(
"debug"
,
default
=
True
,
help
=
"is debug"
,
type
=
bool
)
define
(
"log_path"
,
default
=
'/tmp'
,
help
=
"log path "
,
type
=
str
)
options
.
parse_command_line
()
class
LogFormatter
(
tornado
.
log
.
LogFormatter
):
def
__init__
(
self
):
print
(
'
%(color)
s[
%(asctime)
s
%(filename)
s:
%(funcName)
s:
%(lineno)
d
%(levelname)
s]
%(end_color)
s
%(message)
s'
)
super
(
LogFormatter
,
self
)
.
__init__
(
fmt
=
'
%(color)
s[
%(asctime)
s
%(filename)
s:
%(funcName)
s:
%(lineno)
d
%(levelname)
s]
%(end_color)
s
%(message)
s'
,
datefmt
=
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
...
...
@@ -30,24 +33,19 @@ def apps():
if
__name__
==
"__main__"
:
if
options
:
app
=
apps
()
server
=
HTTPServer
(
app
)
[
i
.
setFormatter
(
LogFormatter
())
for
i
in
logging
.
getLogger
()
.
handlers
]
tornado
.
options
.
parse_command_line
()
# #== 本地调试
app
.
listen
(
2301
0
)
app
.
listen
(
2100
0
)
IOLoop
.
instance
()
.
start
()
#
# from tornado.options import define, options
# define("port", default=23010, help="run on the given port ", type=int)
# define("log_path", default='/tmp', help="log path ", type=str)
# tornado.options.parse_command_line()
# app = apps()
# http_server = tornado.httpserver.HTTPServer(app)
# http_server.bind(options.port)
# http_server.start(num_processes=0)
# tornado.ioloop.IOLoop.instance().start()
else
:
app
=
apps
()
http_server
=
tornado
.
httpserver
.
HTTPServer
(
app
)
http_server
.
bind
(
options
.
port
)
http_server
.
start
()
tornado
.
ioloop
.
IOLoop
.
instance
()
.
start
()
test/Untitled.ipynb
View file @
c9da61e3
...
...
@@ -3,9 +3,7 @@
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [
{
"name": "stdout",
...
...
@@ -62,9 +60,7 @@
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [
{
"data": {
...
...
@@ -73,8 +69,8 @@
]
},
"execution_count": 8,
"
metadata": {}
,
"
output_type": "execute_result"
"
output_type": "execute_result"
,
"
metadata": {}
}
],
"source": [
...
...
@@ -96,7 +92,9 @@
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
"source": [
""
]
}
],
"metadata": {
...
...
@@ -108,7 +106,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"version": 3
.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
...
...
utils/tools.py
View file @
c9da61e3
...
...
@@ -34,8 +34,8 @@ def decrypt(text):
return
bytes
.
decode
(
plain_text
)
.
rstrip
(
'
\0
'
)
#
# if __name__ == '__main__':
# e = encrypt("量化派用户") # 加密
# d = decrypt(e) # 解密
# print("加密:", e)
# print("解密:", d)
\ No newline at end of file
if
__name__
==
'__main__'
:
e
=
encrypt
(
"量化派用户"
)
# 加密
d
=
decrypt
(
e
)
# 解密
print
(
"加密:"
,
e
)
print
(
"解密:"
,
d
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment