kunapi 1.6__tar.gz → 1.8__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 (33) hide show
  1. {kunapi-1.6 → kunapi-1.8}/PKG-INFO +5 -5
  2. {kunapi-1.6 → kunapi-1.8}/kunapi/__init__.py +1 -1
  3. {kunapi-1.6 → kunapi-1.8}/kunapi/app.py +59 -47
  4. {kunapi-1.6 → kunapi-1.8}/kunapi/kunapi.py +3 -3
  5. {kunapi-1.6 → kunapi-1.8}/kunapi.egg-info/PKG-INFO +5 -5
  6. {kunapi-1.6 → kunapi-1.8}/kunapi.egg-info/entry_points.txt +0 -1
  7. {kunapi-1.6 → kunapi-1.8}/kunapi.egg-info/requires.txt +1 -1
  8. {kunapi-1.6 → kunapi-1.8}/setup.py +1 -1
  9. {kunapi-1.6 → kunapi-1.8}/kunapi/Events.py +0 -0
  10. {kunapi-1.6 → kunapi-1.8}/kunapi/common/__init__.py +0 -0
  11. {kunapi-1.6 → kunapi-1.8}/kunapi/common/autoload.py +0 -0
  12. {kunapi-1.6 → kunapi-1.8}/kunapi/common/globals.py +0 -0
  13. {kunapi-1.6 → kunapi-1.8}/kunapi/common/request.py +0 -0
  14. {kunapi-1.6 → kunapi-1.8}/kunapi/config/__init__.py +0 -0
  15. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/__init__.py +0 -0
  16. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/common/__init__.py +0 -0
  17. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/common/autoload.py +0 -0
  18. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/common/model.py +0 -0
  19. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/config/__init__.py +0 -0
  20. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/config/app.py +0 -0
  21. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/index/__init__.py +0 -0
  22. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/index/common/__init__.py +0 -0
  23. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/index/common/autoload.py +0 -0
  24. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/index/controller/__init__.py +0 -0
  25. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/index/controller/index/__init__.py +0 -0
  26. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/index/controller/index/common/__init__.py +0 -0
  27. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/index/controller/index/common/autoload.py +0 -0
  28. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/index/controller/index/common/model.py +0 -0
  29. {kunapi-1.6 → kunapi-1.8}/kunapi/tempfile/kunapi/app/index/controller/index/index.py +0 -0
  30. {kunapi-1.6 → kunapi-1.8}/kunapi.egg-info/SOURCES.txt +0 -0
  31. {kunapi-1.6 → kunapi-1.8}/kunapi.egg-info/dependency_links.txt +0 -0
  32. {kunapi-1.6 → kunapi-1.8}/kunapi.egg-info/top_level.txt +0 -0
  33. {kunapi-1.6 → kunapi-1.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 1.2
1
+ Metadata-Version: 2.1
2
2
  Name: kunapi
3
- Version: 1.6
3
+ Version: 1.8
4
4
  Summary: kunapi
5
5
  Home-page: https://docs.kwebapp.cn/index/index/2
6
6
  Author: 百里-坤坤
@@ -8,6 +8,6 @@ Author-email: fengkun01@qq.com
8
8
  Maintainer: 坤坤
9
9
  Maintainer-email: fengkun01@qq.com
10
10
  License: MIT License
11
- Description: kunapi
12
- Keywords: kunapi1.6
13
- Platform: UNKNOWN
11
+ Keywords: kunapi1.8
12
+
13
+ kunapi
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- __version__ = '1.6'
2
+ __version__ = '1.8'
3
3
  try:
4
4
  from .app import web
5
5
  except:pass
@@ -73,7 +73,7 @@ class web:
73
73
  env['url_scheme']=env['HTTP_X_REAL_IP']
74
74
  except:
75
75
  env['url_scheme']=env['wsgi.url_scheme'],
76
- status,resheader,body=self.__routes(env)
76
+ status,resheader,body=self.__routes(self,env)
77
77
  if type(body) is bytes:
78
78
  pass
79
79
  else:
@@ -248,9 +248,9 @@ class web:
248
248
  globals.VAR.defmodular=''
249
249
  globals.VAR.defplug=''
250
250
  route=self.__config.route
251
- modular=self.__get_modular(header)
251
+ modular=web.__get_modular(self,header)
252
252
  if route['plug']:
253
- getplug=self.__get_plug(header)
253
+ getplug=web.__get_plug(self,header)
254
254
  else:
255
255
  getplug=''
256
256
  routedefault=route['default']
@@ -270,7 +270,8 @@ class web:
270
270
  # plug=route['plug']
271
271
  if getplug:
272
272
  plug=getplug
273
- routedefault,PATH_INFO=self.__getconfigroute(
273
+ routedefault,PATH_INFO=web.__getconfigroute(
274
+ self,
274
275
  PATH_INFO,
275
276
  header
276
277
  )
@@ -287,7 +288,8 @@ class web:
287
288
  param.append(urllib.parse.unquote(path))
288
289
  i+=1
289
290
  else: #配置模块没有配置插件
290
- routedefault,PATH_INFO=self.__getconfigroute(
291
+ routedefault,PATH_INFO=web.__getconfigroute(
292
+ self,
291
293
  PATH_INFO,
292
294
  header
293
295
  )
@@ -310,7 +312,8 @@ class web:
310
312
  # plug=route['plug']
311
313
  elif getplug:
312
314
  plug=getplug
313
- routedefault,PATH_INFO=self.__getconfigroute(
315
+ routedefault,PATH_INFO=web.__getconfigroute(
316
+ self,
314
317
  PATH_INFO,
315
318
  header
316
319
  )
@@ -330,7 +333,7 @@ class web:
330
333
  param.append(urllib.parse.unquote(path))
331
334
  i+=1
332
335
  else: #完全默认
333
- routedefault,PATH_INFO=self.__getconfigroute(PATH_INFO,header)
336
+ routedefault,PATH_INFO=web.__getconfigroute(self,PATH_INFO,header)
334
337
  if routedefault: #使用默认路由
335
338
  for path in PATH_INFO:
336
339
  if path:
@@ -388,7 +391,7 @@ class web:
388
391
  PATH_INFO=header['PATH_INFO'].split('/')
389
392
  if PATH_INFO[0]==' ' or PATH_INFO[0]=='':
390
393
  del PATH_INFO[0]
391
- methods,modular,plug,files,funct,param=self.defaultroute(header,PATH_INFO)
394
+ methods,modular,plug,files,funct,param=web.defaultroute(self,header,PATH_INFO)
392
395
  globals.VAR.component=(methods,modular,plug,files,funct,param)
393
396
  globals.VAR.defmodular=''
394
397
  globals.VAR.defplug=''
@@ -416,7 +419,7 @@ class web:
416
419
  except:
417
420
  globals.HEADER.HTTP_USER_AGENT=None
418
421
  def __del_globals(self):
419
- pass
422
+ # pass
420
423
  globals.VAR = None
421
424
  globals.HEADER = None
422
425
  globals.G = None
@@ -424,14 +427,19 @@ class web:
424
427
  body="这是一个http测试服务器"
425
428
  status="200 ok"
426
429
  resheader={"Content-Type":"application/json; charset=utf-8"}
427
- self.__set_globals(header)
430
+ web.__set_globals(self,header)
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)
428
436
  methods,modular,plug,files,funct,param=globals.VAR.component
429
437
  if header['REQUEST_METHOD'] in methods:
430
438
  try:
431
- obj=getattr(self.__appname,modular)
439
+ obj=getattr(web.__appname,modular)
432
440
  except (AttributeError,UnboundLocalError):
433
441
  status="500 Internal Server Error"
434
- body=self.__tpl(
442
+ body=web.__tpl(
435
443
  title = status,
436
444
  e=status,
437
445
  data="路由不存在:"+str(modular)+"/"
@@ -441,7 +449,7 @@ class web:
441
449
  obj=getattr(obj,"controller")
442
450
  except (AttributeError,UnboundLocalError):
443
451
  status="404 Not Found"
444
- body=self.__tpl(
452
+ body=web.__tpl(
445
453
  title = status,
446
454
  e=status,
447
455
  data="路由不存在:"+str(modular)+"/controller/"
@@ -453,14 +461,15 @@ class web:
453
461
  con="无法找到目录:"+str(modular)+"/controller/"+str(plug)+"/"
454
462
  try:
455
463
  data=getattr(obj,"error")(e,con)
456
- body,status,resheader=self.__tran(
464
+ body,status,resheader=web.__tran(
465
+ self,
457
466
  data,
458
467
  status,
459
468
  resheader
460
469
  )
461
470
  except (AttributeError,UnboundLocalError):
462
471
  status="404 Not Found"
463
- body=self.__tpl(
472
+ body=web.__tpl(
464
473
  title = status,
465
474
  e=status,data=con
466
475
  )
@@ -470,7 +479,7 @@ class web:
470
479
  if self.__config.app['app_debug']:
471
480
  print(traceback.format_exc())
472
481
  errms=traceback.format_exc().split("\n")
473
- body=self.__tpl(
482
+ body=web.__tpl(
474
483
  title = status,
475
484
  data=errms,e=e
476
485
  )
@@ -481,14 +490,15 @@ class web:
481
490
  con="无法找到文件:"+str(modular)+"/controller/"+str(plug)+"/"+str(files)+".py"
482
491
  try:
483
492
  data=getattr(obj,"error")(e,con)
484
- body,status,resheader=self.__tran(
485
- data
493
+ body,status,resheader=web.__tran(
494
+ self
495
+ ,data
486
496
  ,status
487
497
  ,resheader
488
498
  )
489
499
  except (AttributeError,UnboundLocalError):
490
500
  status="404 Not Found"
491
- body=self.__tpl(
501
+ body=web.__tpl(
492
502
  title = status
493
503
  ,data=con
494
504
  ,e=status)
@@ -498,7 +508,7 @@ class web:
498
508
  if self.__config.app['app_debug']:
499
509
  print(traceback.format_exc())
500
510
  errms=traceback.format_exc().split("\n")
501
- body=self.__tpl(
511
+ body=web.__tpl(
502
512
  title = status,
503
513
  data=errms,
504
514
  e=e
@@ -510,8 +520,8 @@ class web:
510
520
  try:
511
521
  data=getattr(obj,self.__config.app['before_request'])()
512
522
  if data:
513
- body,status,resheader=self.__tran(
514
- data,
523
+ body,status,resheader=web.__tran(
524
+ self,data,
515
525
  status,
516
526
  resheader
517
527
  )
@@ -521,8 +531,8 @@ class web:
521
531
  except Exception as e:
522
532
  try:
523
533
  data=getattr(obj,"error")(e,traceback.format_exc().split("\n"))
524
- body,status,resheader=self.__tran(
525
- data,
534
+ body,status,resheader=web.__tran(
535
+ self,data,
526
536
  status,
527
537
  resheader
528
538
  )
@@ -532,7 +542,7 @@ class web:
532
542
  errms=status
533
543
  if self.__config.app['app_debug']:
534
544
  errms=traceback.format_exc().split("\n")
535
- body=self.__tpl(
545
+ body=web.__tpl(
536
546
  title = status,
537
547
  data=errms,e=e
538
548
  )
@@ -543,7 +553,7 @@ class web:
543
553
  if self.__config.app['app_debug']:
544
554
  print(traceback.format_exc())
545
555
  errms=traceback.format_exc().split("\n")
546
- body=self.__tpl(
556
+ body=web.__tpl(
547
557
  title = status,
548
558
  data=errms,e=e
549
559
  )
@@ -554,16 +564,16 @@ class web:
554
564
  data=getattr(obj,funct)(*param) #兼容性之前的控制器
555
565
  else:
556
566
  data=getattr(objclass,funct)(*param)
557
- body,status,resheader=self.__tran(
558
- data,
567
+ body,status,resheader=web.__tran(
568
+ self,data,
559
569
  status,
560
570
  resheader
561
571
  )
562
572
  except Exception as e:
563
573
  try:
564
574
  data=getattr(obj,"error")(e,traceback.format_exc().split("\n"))
565
- body,status,resheader=self.__tran(
566
- data,
575
+ body,status,resheader=web.__tran(
576
+ self,data,
567
577
  status,
568
578
  resheader
569
579
  )
@@ -573,7 +583,7 @@ class web:
573
583
  if self.__config.app['app_debug']:
574
584
  print(traceback.format_exc())
575
585
  errms=traceback.format_exc().split("\n")
576
- body=self.__tpl(
586
+ body=web.__tpl(
577
587
  title = status,
578
588
  data=errms,
579
589
  e=e
@@ -584,14 +594,14 @@ class web:
584
594
  if self.__config.app['app_debug']:
585
595
  print(traceback.format_exc())
586
596
  errms=traceback.format_exc().split("\n")
587
- body=self.__tpl(
597
+ body=web.__tpl(
588
598
  title = status,
589
599
  data=errms,
590
600
  e=e
591
601
  )
592
602
  else:
593
603
  status="405 Method Not Allowed"
594
- body=self.__tpl(
604
+ body=web.__tpl(
595
605
  title = status,
596
606
  data='405 Method Not Allowed',
597
607
  e=''
@@ -605,13 +615,13 @@ class web:
605
615
  try:
606
616
  data=getattr(obj,self.__config.app['after_request'])(body,status,resheader)
607
617
  if data:
608
- body,status,resheader=self.__tran(data,status,resheader)
618
+ body,status,resheader=web.__tran(self,data,status,resheader)
609
619
  except (AttributeError,UnboundLocalError):pass
610
620
  except Exception as e:
611
621
  try:
612
622
  data=getattr(obj,"error")(e,traceback.format_exc().split("\n"))
613
- body,status,resheader=self.__tran(
614
- data,
623
+ body,status,resheader=web.__tran(
624
+ self,data,
615
625
  status,
616
626
  resheader
617
627
  )
@@ -621,7 +631,7 @@ class web:
621
631
  if self.__config.app['app_debug']:
622
632
  print(traceback.format_exc())
623
633
  errms=traceback.format_exc().split("\n")
624
- body=self.__tpl(
634
+ body=web.__tpl(
625
635
  title = status
626
636
  ,data=errms,
627
637
  e=e
@@ -632,7 +642,7 @@ class web:
632
642
  if self.__config.app['app_debug']:
633
643
  print(traceback.format_exc())
634
644
  errms=traceback.format_exc().split("\n")
635
- body=self.__tpl(
645
+ body=web.__tpl(
636
646
  title = status,
637
647
  data=errms,
638
648
  e=""
@@ -640,12 +650,15 @@ class web:
640
650
  resheaders=[]
641
651
  for key in resheader:
642
652
  resheaders.append((key,resheader[key]))
653
+ web.__del_globals(self)
654
+
655
+
643
656
  if self.__config.fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr=='kwebs' or self.__config.fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr=='kwebsp':#请求后执行的函数
644
657
  try:
645
658
  getattr(obj,"rfdsgeagesegdsfdsfdrrsebskwebsafterrequest")() #关闭数据库相关连接
646
659
  except:pass
647
660
 
648
- self.__del_globals()
661
+
649
662
  if isinstance(resheaders,list):
650
663
  if not body:
651
664
  body=''
@@ -655,15 +668,15 @@ class web:
655
668
  body=str(body)
656
669
  return str(status),resheaders,body
657
670
  else:
658
- raise
659
- def __tpl(self,**context):
671
+ raise Exception()
672
+ def __tpl(**context):
660
673
  arr=json_encode({
661
674
  'title':context['title'],
662
675
  'msg':str(context['e']),
663
676
  'error':context['data']
664
677
  })
665
678
  return arr
666
- # def __tpl(__tpl,**context):
679
+ # def __tpl(**context):
667
680
  # title,status,error=context
668
681
  # arr=json_encode({
669
682
  # 'title':title,
@@ -730,7 +743,6 @@ class web:
730
743
  'HTTP_X_REAL_IP':env.get('HTTP_X_REAL_IP'),
731
744
  'files':files
732
745
  }
733
-
734
746
  p=(config.app['staticpath']+reqheader['RAW_URI'].replace(' ',''))
735
747
  status='200 ok'
736
748
  if os.path.isfile(p):
@@ -763,7 +775,7 @@ class web:
763
775
  resheader.append(("Last-Modified",otherStyleTime))
764
776
  resheader.append(("ETag",ETag))
765
777
  else:
766
- status,resheader,body=self.__routes(reqheader)
778
+ status,resheader,body=web.__routes(self,reqheader)
767
779
  from kunapi import __version__
768
780
  resheader.append(('Server', "kunapi-"+__version__))
769
781
  if type(body) is bytes:
@@ -772,7 +784,7 @@ class web:
772
784
  body=bytes(body, encoding='utf-8')
773
785
  start_response(status,resheader)
774
786
  return [body]
775
- def __waitress(self,host,port,threads=1):
787
+ def __waitress(self,host,port):
776
788
  if host=='0.0.0.0':
777
789
  print("\033[32m* (CTRL+单击打开)http://127.0.0.1:"+str(port)+"(按CTRL+C退出)")
778
790
  else:
@@ -782,8 +794,8 @@ class web:
782
794
  else:
783
795
  print('\033[37m* 调试器:已关闭')
784
796
  from waitress import serve
785
- serve(self.__application, host=host, port=port,threads=threads,channel_timeout=3600) #框架不支持多线程 所以 threads设为1
786
- def __http_wsgi(self,host,port):
797
+ serve(self.__application, host=host, port=port,threads=1,channel_timeout=3600) #框架不支持多线程 所以 threads设为1
798
+ def __http_wsgi(self,host,port,filename):
787
799
  "http——wsgi测试服务 windows建议使用Waitress‌"
788
800
  from wsgiref.simple_server import make_server
789
801
  print("* \033[1;31;40m! 警告:\033[0m这是一个wsgiref开发服务器。不要在生产环境中部署使用它")
@@ -8,9 +8,9 @@ def get_cmd_par(fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr=''):
8
8
  if fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr:
9
9
  fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1=fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr
10
10
  python_version=platform.python_version()
11
- if python_version[0:3]!='3.8':
12
- print("\033[1;31;40m "+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+"依赖python3.8,与你现在的python"+python_version+"不兼容")
13
- exit()
11
+ # if python_version[0:3]!='3.8':
12
+ # print("\033[1;31;40m "+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+"依赖python3.8,与你现在的python"+python_version+"不兼容")
13
+ # exit()
14
14
  if 'Linux' in get_sysinfo()['platform'] or 'Windows' in get_sysinfo()['platform']:pass
15
15
  else:
16
16
  print("\033[1;31;40m "+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+"不支持当前操作系统 解压在linux或windows系统下运行")
@@ -1,6 +1,6 @@
1
- Metadata-Version: 1.2
1
+ Metadata-Version: 2.1
2
2
  Name: kunapi
3
- Version: 1.6
3
+ Version: 1.8
4
4
  Summary: kunapi
5
5
  Home-page: https://docs.kwebapp.cn/index/index/2
6
6
  Author: 百里-坤坤
@@ -8,6 +8,6 @@ Author-email: fengkun01@qq.com
8
8
  Maintainer: 坤坤
9
9
  Maintainer-email: fengkun01@qq.com
10
10
  License: MIT License
11
- Description: kunapi
12
- Keywords: kunapi1.6
13
- Platform: UNKNOWN
11
+ Keywords: kunapi1.8
12
+
13
+ kunapi
@@ -1,3 +1,2 @@
1
1
  [console_scripts]
2
2
  kunapi = kunapi.kunapi:cill_start
3
-
@@ -2,5 +2,5 @@ gunicorn==20.0.4
2
2
  waitress==3.0.0
3
3
  watchdog==4.0.0
4
4
  filetype==1.2.0
5
- psutil==5.8.0
5
+ psutil==5.9.4
6
6
  requests==2.32.4
@@ -31,7 +31,7 @@ def start():
31
31
  maintainer_email = kcwsinfo["maintainer_email"],
32
32
  url=kcwsinfo['url'],
33
33
  packages = b,
34
- install_requires = ['gunicorn==20.0.4','waitress==3.0.0','watchdog==4.0.0','filetype==1.2.0','psutil==5.8.0','requests==2.32.4'], #第三方包
34
+ install_requires = ['gunicorn==20.0.4','waitress==3.0.0','watchdog==4.0.0','filetype==1.2.0','psutil==5.9.4','requests==2.32.4'], #第三方包
35
35
  package_data = {
36
36
  '': ['*.html', '*.js','*.css','*.jpg','*.png','*.gif'],
37
37
  },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes