From ba24e22147e9c2d13447c6509974fec4a11ffae7 Mon Sep 17 00:00:00 2001
From: WuXianChaoPin <1029559041@qq.com>
Date: Fri, 4 May 2018 18:44:29 +0800
Subject: [PATCH] thift
---
PixivSearch/templates/index.html | 6 +++---
PixivSearch/thrift/TestQry/Client.py | 4 ++--
PixivSearch/thrift/TestQry/Server.py | 4 ++++
PixivSearch/thrift/TestQry/TestQry-remote | 7 +++++--
PixivSearch/thrift/TestQry/TestQry.py | 2 --
root.ini | 2 ++
root.py | 11 +++++++++++
7 files changed, 27 insertions(+), 9 deletions(-)
create mode 100644 root.ini
create mode 100644 root.py
diff --git a/PixivSearch/templates/index.html b/PixivSearch/templates/index.html
index 9d2d15b..24979ab 100644
--- a/PixivSearch/templates/index.html
+++ b/PixivSearch/templates/index.html
@@ -31,13 +31,13 @@
-
-
+
+{# #}
+{# #}
{% if download %}
图包提取(文件大小:{{ size}})
-{# #}
{% endif %}
diff --git a/PixivSearch/thrift/TestQry/Client.py b/PixivSearch/thrift/TestQry/Client.py
index 22237b5..89fea10 100644
--- a/PixivSearch/thrift/TestQry/Client.py
+++ b/PixivSearch/thrift/TestQry/Client.py
@@ -3,12 +3,12 @@ import sys
from thrift.protocol import TBinaryProtocol
from thrift.transport import TSocket, TTransport
-sys.path.append("/home/hua/PycharmProjects/PixivSearch")
+sys.path.append('/root/PixivSearch')
from PixivSearch.thrift.TestQry.TestQry import Client
if __name__ == '__main__':
# Make socket
- socket = TSocket.TSocket('127.0.0.1', 2233)
+ socket = TSocket.TSocket('mikuhime.xyz', 2233)
# Buffering is critical. Raw sockets are very slow
transport = TTransport.TFramedTransport(socket)
diff --git a/PixivSearch/thrift/TestQry/Server.py b/PixivSearch/thrift/TestQry/Server.py
index 4e78d52..a31e9e5 100644
--- a/PixivSearch/thrift/TestQry/Server.py
+++ b/PixivSearch/thrift/TestQry/Server.py
@@ -1,6 +1,9 @@
+import sys
+
from thrift.server.TNonblockingServer import TNonblockingServer
from thrift.transport import TSocket
+sys.path.append('/root/PixivSearch')
from PixivSearch.thrift.TestQry import TestQry
from PixivSearch.thrift.TestQry.ttypes import QryResult
@@ -12,6 +15,7 @@ class QueryImpl(TestQry.Iface):
if qryCode == 1:
result.code = 1
result.msg = 'success'
+
else:
result.code = 0
result.msg = 'fail'
diff --git a/PixivSearch/thrift/TestQry/TestQry-remote b/PixivSearch/thrift/TestQry/TestQry-remote
index 3a5edd1..c12dd5a 100755
--- a/PixivSearch/thrift/TestQry/TestQry-remote
+++ b/PixivSearch/thrift/TestQry/TestQry-remote
@@ -10,8 +10,11 @@
import sys
import pprint
from urllib.parse import urlparse
-sys.path.append("/home/hua/PycharmProjects/PixivSearch")
-from PixivSearch.thrift import TestQry
+
+from PixivSearch.thrift.TestQry import TestQry
+
+sys.path.append('/root/PixivSearch')
+
from thrift.transport import TTransport, TSocket, TSSLSocket, THttpClient
from thrift.protocol.TBinaryProtocol import TBinaryProtocol
diff --git a/PixivSearch/thrift/TestQry/TestQry.py b/PixivSearch/thrift/TestQry/TestQry.py
index 4114cd0..228ef8d 100644
--- a/PixivSearch/thrift/TestQry/TestQry.py
+++ b/PixivSearch/thrift/TestQry/TestQry.py
@@ -16,8 +16,6 @@ from PixivSearch.thrift.TestQry.ttypes import QryResult
all_structs = []
-port=2233
-
class Iface(object):
def qryTest(self, qryCode):
"""
diff --git a/root.ini b/root.ini
new file mode 100644
index 0000000..828fda0
--- /dev/null
+++ b/root.ini
@@ -0,0 +1,2 @@
+[config]
+bastPath=/root/PixivSearch
\ No newline at end of file
diff --git a/root.py b/root.py
new file mode 100644
index 0000000..8994557
--- /dev/null
+++ b/root.py
@@ -0,0 +1,11 @@
+import configparser
+
+cf = configparser.ConfigParser()
+cf.read('root.ini')
+
+def getConfigValue(name):
+ value = cf.get("config", name)
+ return value
+
+if __name__ == '__main__':
+ print(getConfigValue('bastPath'))
\ No newline at end of file