kunapi 1.5__tar.gz → 1.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {kunapi-1.5 → kunapi-1.7}/PKG-INFO +2 -2
  2. {kunapi-1.5 → kunapi-1.7}/kunapi/__init__.py +1 -1
  3. {kunapi-1.5 → kunapi-1.7}/kunapi/app.py +27 -12
  4. kunapi-1.7/kunapi/common/globals.py +9 -0
  5. {kunapi-1.5 → kunapi-1.7}/kunapi/common/request.py +4 -1
  6. {kunapi-1.5 → kunapi-1.7}/kunapi/kunapi.py +7 -2
  7. {kunapi-1.5 → kunapi-1.7}/kunapi.egg-info/PKG-INFO +2 -2
  8. {kunapi-1.5 → kunapi-1.7}/kunapi.egg-info/SOURCES.txt +20 -0
  9. kunapi-1.5/kunapi/common/globals.py +0 -9
  10. {kunapi-1.5 → kunapi-1.7}/kunapi/Events.py +0 -0
  11. {kunapi-1.5 → kunapi-1.7}/kunapi/common/__init__.py +0 -0
  12. {kunapi-1.5 → kunapi-1.7}/kunapi/common/autoload.py +0 -0
  13. {kunapi-1.5 → kunapi-1.7}/kunapi/config/__init__.py +0 -0
  14. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/__init__.py +0 -0
  15. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/common/__init__.py +0 -0
  16. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/common/autoload.py +0 -0
  17. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/common/model.py +0 -0
  18. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/config/__init__.py +0 -0
  19. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/config/app.py +0 -0
  20. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/index/__init__.py +0 -0
  21. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/index/common/__init__.py +0 -0
  22. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/index/common/autoload.py +0 -0
  23. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/index/controller/__init__.py +0 -0
  24. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/index/controller/index/__init__.py +0 -0
  25. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/index/controller/index/common/__init__.py +0 -0
  26. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/index/controller/index/common/autoload.py +0 -0
  27. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/index/controller/index/common/model.py +0 -0
  28. {kunapi-1.5 → kunapi-1.7}/kunapi/tempfile/kunapi/app/index/controller/index/index.py +0 -0
  29. {kunapi-1.5 → kunapi-1.7}/kunapi.egg-info/dependency_links.txt +0 -0
  30. {kunapi-1.5 → kunapi-1.7}/kunapi.egg-info/entry_points.txt +0 -0
  31. {kunapi-1.5 → kunapi-1.7}/kunapi.egg-info/requires.txt +0 -0
  32. {kunapi-1.5 → kunapi-1.7}/kunapi.egg-info/top_level.txt +0 -0
  33. {kunapi-1.5 → kunapi-1.7}/setup.cfg +0 -0
  34. {kunapi-1.5 → kunapi-1.7}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.2
2
2
  Name: kunapi
3
- Version: 1.5
3
+ Version: 1.7
4
4
  Summary: kunapi
5
5
  Home-page: https://docs.kwebapp.cn/index/index/2
6
6
  Author: 百里-坤坤
@@ -9,5 +9,5 @@ Maintainer: 坤坤
9
9
  Maintainer-email: fengkun01@qq.com
10
10
  License: MIT License
11
11
  Description: kunapi
12
- Keywords: kunapi1.5
12
+ Keywords: kunapi1.7
13
13
  Platform: UNKNOWN
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- __version__ = '1.5'
2
+ __version__ = '1.7'
3
3
  try:
4
4
  from .app import web
5
5
  except:pass
@@ -382,8 +382,21 @@ class web:
382
382
  body=data
383
383
  return body,status,resheader
384
384
  def __set_globals(self,header):
385
+
386
+
387
+ globals.VAR = threading.local()
388
+ globals.HEADER = threading.local()
389
+ globals.G = threading.local()
390
+
391
+ PATH_INFO=header['PATH_INFO'].split('/')
392
+ if PATH_INFO[0]==' ' or PATH_INFO[0]=='':
393
+ del PATH_INFO[0]
394
+ methods,modular,plug,files,funct,param=web.defaultroute(self,header,PATH_INFO)
395
+ globals.VAR.component=(methods,modular,plug,files,funct,param)
396
+ globals.VAR.defmodular=''
397
+ globals.VAR.defplug=''
398
+
385
399
  globals.HEADER.GET=header
386
- # globals.HEADER.url_scheme=header['url_scheme']
387
400
  globals.HEADER.Method=header['REQUEST_METHOD']
388
401
  globals.HEADER.URL=header['RAW_URI']
389
402
  globals.HEADER.PATH_INFO=header['PATH_INFO']
@@ -405,20 +418,22 @@ class web:
405
418
  globals.HEADER.HTTP_USER_AGENT=header['HTTP_USER_AGENT']
406
419
  except:
407
420
  globals.HEADER.HTTP_USER_AGENT=None
408
- def __del_globals():
409
- globals.VAR = threading.local()
410
- globals.HEADER = threading.local()
411
- globals.G = threading.local()
421
+ def __del_globals(self):
422
+ # pass
423
+ globals.VAR = None
424
+ globals.HEADER = None
425
+ globals.G = None
412
426
  def __routes(self,header):
413
427
  body="这是一个http测试服务器"
414
428
  status="200 ok"
415
429
  resheader={"Content-Type":"application/json; charset=utf-8"}
416
430
  web.__set_globals(self,header)
417
- PATH_INFO=header['PATH_INFO'].split('/')
418
- if PATH_INFO[0]==' ' or PATH_INFO[0]=='':
419
- del PATH_INFO[0]
420
- methods,modular,plug,files,funct,param=web.defaultroute(self,header,PATH_INFO)
421
- globals.VAR.component=(methods,modular,plug,files,funct,param)
431
+ # PATH_INFO=header['PATH_INFO'].split('/')
432
+ # if PATH_INFO[0]==' ' or PATH_INFO[0]=='':
433
+ # del PATH_INFO[0]
434
+ # methods,modular,plug,files,funct,param=web.defaultroute(self,header,PATH_INFO)
435
+ # globals.VAR.component=(methods,modular,plug,files,funct,param)
436
+ methods,modular,plug,files,funct,param=globals.VAR.component
422
437
  if header['REQUEST_METHOD'] in methods:
423
438
  try:
424
439
  obj=getattr(web.__appname,modular)
@@ -635,7 +650,7 @@ class web:
635
650
  resheaders=[]
636
651
  for key in resheader:
637
652
  resheaders.append((key,resheader[key]))
638
- web.__del_globals()
653
+ web.__del_globals(self)
639
654
 
640
655
 
641
656
  if self.__config.fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr=='kwebs' or self.__config.fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr=='kwebsp':#请求后执行的函数
@@ -779,7 +794,7 @@ class web:
779
794
  else:
780
795
  print('\033[37m* 调试器:已关闭')
781
796
  from waitress import serve
782
- serve(self.__application, host=host, port=port)
797
+ serve(self.__application, host=host, port=port,threads=1,channel_timeout=3600) #框架不支持多线程 所以 threads设为1
783
798
  def __http_wsgi(self,host,port,filename):
784
799
  "http——wsgi测试服务 windows建议使用Waitress‌"
785
800
  from wsgiref.simple_server import make_server
@@ -0,0 +1,9 @@
1
+ # -*- coding: utf-8 -*-
2
+ import threading
3
+ ##普通全局变量 请求结束后删除
4
+ VAR = threading.local()
5
+ HEADER = threading.local()
6
+ G = threading.local()
7
+
8
+
9
+
@@ -113,7 +113,10 @@ class HEADER:
113
113
  def SERVER_PROTOCOL():
114
114
  return kcwsglobals.HEADER.SERVER_PROTOCOL
115
115
  def HTTP_HOST():
116
- return kcwsglobals.HEADER.HTTP_HOST
116
+ if kcwsglobals.HEADER.HTTP_HOST:
117
+ return kcwsglobals.HEADER.HTTP_HOST
118
+ else:
119
+ return ''
117
120
  def HTTP_COOKIE():
118
121
  return kcwsglobals.HEADER.HTTP_COOKIE
119
122
  def HTTP_USER_AGENT():
@@ -11,6 +11,10 @@ def get_cmd_par(fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr=''):
11
11
  if python_version[0:3]!='3.8':
12
12
  print("\033[1;31;40m "+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+"依赖python3.8,与你现在的python"+python_version+"不兼容")
13
13
  exit()
14
+ if 'Linux' in get_sysinfo()['platform'] or 'Windows' in get_sysinfo()['platform']:pass
15
+ else:
16
+ print("\033[1;31;40m "+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+"不支持当前操作系统 解压在linux或windows系统下运行")
17
+ exit()
14
18
  try:
15
19
  opts, args = getopt.getopt(sys.argv[1:], "h", ["project=","app=","modular=","plug=","user=","pwd=","host=","port=","timeout=","processcount=",
16
20
  "install","uninstall","pack","upload","cli"])
@@ -256,7 +260,7 @@ def cllfunction():
256
260
  else:
257
261
  save_route_cli_pid('pid/'+str(sys.argv[tar-1])+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+'_server_pid')
258
262
  app.run(host=cmd_par['host'],port=int(cmd_par['port']))
259
- else:
263
+ elif 'Linux' in get_sysinfo()['platform']:
260
264
  pythonpath=site.getsitepackages()[0].replace('\\','/')
261
265
  t=pythonpath.split('/')
262
266
  tt='/'+t[-3]+'/'+t[-2]+'/'+t[-1]
@@ -281,7 +285,8 @@ def cllfunction():
281
285
  sys.argv=[sys.argv[0], '-w', str(cmd_par['processcount']), '-b', cmd_par['host']+':'+str(cmd_par['port']),'-t',cmd_par['timeout'], 'server:'+cmd_par['appname']]
282
286
  sys.exit(run())
283
287
  exit()
284
-
288
+ else:
289
+ raise Exception('不支持该操作系统')
285
290
  elif cmd_par['install'] or cmd_par['pack'] or cmd_par['upload'] or cmd_par['uninstall']:
286
291
  if cmd_par['install']:#插入 应用、模块、插件
287
292
  if cmd_par['appname'] and cmd_par['modular']:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.2
2
2
  Name: kunapi
3
- Version: 1.5
3
+ Version: 1.7
4
4
  Summary: kunapi
5
5
  Home-page: https://docs.kwebapp.cn/index/index/2
6
6
  Author: 百里-坤坤
@@ -9,5 +9,5 @@ Maintainer: 坤坤
9
9
  Maintainer-email: fengkun01@qq.com
10
10
  License: MIT License
11
11
  Description: kunapi
12
- Keywords: kunapi1.5
12
+ Keywords: kunapi1.7
13
13
  Platform: UNKNOWN
@@ -28,4 +28,24 @@ kunapi/tempfile/kunapi/app/index/controller/index/__init__.py
28
28
  kunapi/tempfile/kunapi/app/index/controller/index/index.py
29
29
  kunapi/tempfile/kunapi/app/index/controller/index/common/__init__.py
30
30
  kunapi/tempfile/kunapi/app/index/controller/index/common/autoload.py
31
+ kunapi/tempfile/kunapi/app/index/controller/index/common/model.py
32
+ kunapi/common/__init__.py
33
+ kunapi/common/autoload.py
34
+ kunapi/common/globals.py
35
+ kunapi/common/request.py
36
+ kunapi/config/__init__.py
37
+ kunapi/tempfile/kunapi/app/__init__.py
38
+ kunapi/tempfile/kunapi/app/common/__init__.py
39
+ kunapi/tempfile/kunapi/app/common/autoload.py
40
+ kunapi/tempfile/kunapi/app/common/model.py
41
+ kunapi/tempfile/kunapi/app/config/__init__.py
42
+ kunapi/tempfile/kunapi/app/config/app.py
43
+ kunapi/tempfile/kunapi/app/index/__init__.py
44
+ kunapi/tempfile/kunapi/app/index/common/__init__.py
45
+ kunapi/tempfile/kunapi/app/index/common/autoload.py
46
+ kunapi/tempfile/kunapi/app/index/controller/__init__.py
47
+ kunapi/tempfile/kunapi/app/index/controller/index/__init__.py
48
+ kunapi/tempfile/kunapi/app/index/controller/index/index.py
49
+ kunapi/tempfile/kunapi/app/index/controller/index/common/__init__.py
50
+ kunapi/tempfile/kunapi/app/index/controller/index/common/autoload.py
31
51
  kunapi/tempfile/kunapi/app/index/controller/index/common/model.py
@@ -1,9 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from threading import local
3
- ##普通全局变量 请求结束后删除
4
- VAR = local()
5
- HEADER = local()
6
- G = local()
7
-
8
-
9
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes