pytbox 0.0.1__py3-none-any.whl → 0.3.1__py3-none-any.whl

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.

Potentially problematic release.


This version of pytbox might be problematic. Click here for more details.

Files changed (68) hide show
  1. pytbox/alert/alert_handler.py +139 -0
  2. pytbox/alert/ping.py +24 -0
  3. pytbox/alicloud/sls.py +9 -14
  4. pytbox/base.py +121 -0
  5. pytbox/categraf/build_config.py +143 -0
  6. pytbox/categraf/instances.toml +39 -0
  7. pytbox/categraf/jinja2/__init__.py +6 -0
  8. pytbox/categraf/jinja2/input.cpu/cpu.toml.j2 +5 -0
  9. pytbox/categraf/jinja2/input.disk/disk.toml.j2 +11 -0
  10. pytbox/categraf/jinja2/input.diskio/diskio.toml.j2 +6 -0
  11. pytbox/categraf/jinja2/input.dns_query/dns_query.toml.j2 +12 -0
  12. pytbox/categraf/jinja2/input.http_response/http_response.toml.j2 +9 -0
  13. pytbox/categraf/jinja2/input.mem/mem.toml.j2 +5 -0
  14. pytbox/categraf/jinja2/input.net/net.toml.j2 +11 -0
  15. pytbox/categraf/jinja2/input.net_response/net_response.toml.j2 +9 -0
  16. pytbox/categraf/jinja2/input.ping/ping.toml.j2 +11 -0
  17. pytbox/categraf/jinja2/input.prometheus/prometheus.toml.j2 +12 -0
  18. pytbox/categraf/jinja2/input.snmp/cisco_interface.toml.j2 +96 -0
  19. pytbox/categraf/jinja2/input.snmp/cisco_system.toml.j2 +41 -0
  20. pytbox/categraf/jinja2/input.snmp/h3c_interface.toml.j2 +96 -0
  21. pytbox/categraf/jinja2/input.snmp/h3c_system.toml.j2 +41 -0
  22. pytbox/categraf/jinja2/input.snmp/huawei_interface.toml.j2 +96 -0
  23. pytbox/categraf/jinja2/input.snmp/huawei_system.toml.j2 +41 -0
  24. pytbox/categraf/jinja2/input.snmp/ruijie_interface.toml.j2 +96 -0
  25. pytbox/categraf/jinja2/input.snmp/ruijie_system.toml.j2 +41 -0
  26. pytbox/categraf/jinja2/input.vsphere/vsphere.toml.j2 +211 -0
  27. pytbox/cli/__init__.py +7 -0
  28. pytbox/cli/categraf/__init__.py +7 -0
  29. pytbox/cli/categraf/commands.py +55 -0
  30. pytbox/cli/commands/vm.py +22 -0
  31. pytbox/cli/common/__init__.py +6 -0
  32. pytbox/cli/common/options.py +42 -0
  33. pytbox/cli/common/utils.py +269 -0
  34. pytbox/cli/formatters/__init__.py +7 -0
  35. pytbox/cli/formatters/output.py +155 -0
  36. pytbox/cli/main.py +24 -0
  37. pytbox/cli.py +9 -0
  38. pytbox/database/mongo.py +99 -0
  39. pytbox/database/victoriametrics.py +404 -0
  40. pytbox/dida365.py +11 -17
  41. pytbox/excel.py +64 -0
  42. pytbox/feishu/endpoints.py +12 -9
  43. pytbox/{logger.py → log/logger.py} +78 -30
  44. pytbox/{victorialog.py → log/victorialog.py} +2 -2
  45. pytbox/mail/alimail.py +142 -0
  46. pytbox/mail/client.py +171 -0
  47. pytbox/mail/mail_detail.py +30 -0
  48. pytbox/mingdao.py +164 -0
  49. pytbox/network/meraki.py +537 -0
  50. pytbox/notion.py +731 -0
  51. pytbox/pyjira.py +612 -0
  52. pytbox/utils/cronjob.py +79 -0
  53. pytbox/utils/env.py +2 -2
  54. pytbox/utils/load_config.py +132 -0
  55. pytbox/utils/load_vm_devfile.py +45 -0
  56. pytbox/utils/response.py +1 -1
  57. pytbox/utils/richutils.py +31 -0
  58. pytbox/utils/timeutils.py +479 -14
  59. pytbox/vmware.py +120 -0
  60. pytbox/win/ad.py +30 -0
  61. {pytbox-0.0.1.dist-info → pytbox-0.3.1.dist-info}/METADATA +13 -3
  62. pytbox-0.3.1.dist-info/RECORD +72 -0
  63. pytbox-0.3.1.dist-info/entry_points.txt +2 -0
  64. pytbox/common/base.py +0 -0
  65. pytbox/victoriametrics.py +0 -37
  66. pytbox-0.0.1.dist-info/RECORD +0 -21
  67. {pytbox-0.0.1.dist-info → pytbox-0.3.1.dist-info}/WHEEL +0 -0
  68. {pytbox-0.0.1.dist-info → pytbox-0.3.1.dist-info}/top_level.txt +0 -0
@@ -1,20 +1,30 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytbox
3
- Version: 0.0.1
3
+ Version: 0.3.1
4
4
  Summary: A collection of Python integrations and utilities (Feishu, Dida365, VictoriaMetrics, ...)
5
5
  Author-email: mingming hou <houm01@foxmail.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Requires-Python: >=3.8
8
8
  Description-Content-Type: text/markdown
9
9
  Requires-Dist: requests>=2.0
10
10
  Requires-Dist: pydantic>=1.10
11
- Requires-Dist: onepassword>=1.0.0
12
11
  Requires-Dist: onepasswordconnectsdk>=1.0.0
12
+ Requires-Dist: loguru>=0.7.3
13
+ Requires-Dist: chinese_calendar>=1.10.0
14
+ Requires-Dist: click>=8.0.0
15
+ Requires-Dist: rich>=12.0.0
16
+ Requires-Dist: jinja2>=3.0.0
17
+ Requires-Dist: toml>=0.10.0
18
+ Requires-Dist: ldap3>=2.9.1
19
+ Requires-Dist: imap-tools>=1.11.0
20
+ Requires-Dist: yagmail>=0.15.293
13
21
  Provides-Extra: dev
14
22
  Requires-Dist: pytest; extra == "dev"
15
23
  Requires-Dist: black; extra == "dev"
16
24
  Requires-Dist: ruff; extra == "dev"
17
25
  Requires-Dist: python-dotenv; extra == "dev"
26
+ Provides-Extra: cli
27
+ Requires-Dist: pyyaml>=6.0; extra == "cli"
18
28
 
19
29
  # PytBox
20
30
 
@@ -0,0 +1,72 @@
1
+ pytbox/base.py,sha256=WC_p_PYMMpNq-5JRLyZoD74k-d2EQVmO4VjTvnI7VqE,4541
2
+ pytbox/cli.py,sha256=N775a0GK80IT2lQC2KRYtkZpIiu9UjavZmaxgNUgJhQ,160
3
+ pytbox/dida365.py,sha256=pUMPB9AyLZpTTbaz2LbtzdEpyjvuGf4YlRrCvM5sbJo,10545
4
+ pytbox/excel.py,sha256=f5XBLCeJbGgxytoSwVhbk03WLTzz8Q3IJ_RZ2-r_w6A,2334
5
+ pytbox/mingdao.py,sha256=afEFJ9NKPdsmAZ4trBEJKl66fMj3Z8TWfaOcomNGhzw,6042
6
+ pytbox/notion.py,sha256=GRPdZAtyG2I6M6pCFbdrTWDACaPsp1RAXrY_RpWYKus,26572
7
+ pytbox/onepassword_connect.py,sha256=nD3xTl1ykQ4ct_dCRRF138gXCtk-phPfKYXuOn-P7Z8,3064
8
+ pytbox/onepassword_sa.py,sha256=08iUcYud3aEHuQcUsem9bWNxdXKgaxFbMy9yvtr-DZQ,6995
9
+ pytbox/pyjira.py,sha256=Str9f7qTeBuy8XtJq2bXBI9ib79aQYCHBlJP1QKtZeo,24605
10
+ pytbox/vmware.py,sha256=WiH67_3-VCBjXJuh3UueOc31BdZDItiZhkeuPzoRhw4,3975
11
+ pytbox/alert/alert_handler.py,sha256=WCn4cKahv5G5BFGgmc7dX7BQ38h2kxTgxfRVTwc1O2M,6579
12
+ pytbox/alert/ping.py,sha256=KEnnXdIRJHvR_rEHPWLBt0wz4cGwmA29Lenlak3Z_1Y,778
13
+ pytbox/alicloud/sls.py,sha256=-r6rbCwDUQ4jwAgSVSNu7B2h1MNg20CrRIKnlXVeY9w,4159
14
+ pytbox/categraf/build_config.py,sha256=9G85rLqkz3lchpH7ef0LbvckYHl0nRA6mHVLeUfs9Mw,6308
15
+ pytbox/categraf/instances.toml,sha256=jcJyEaqhohUcECczWArxUK4t0-rdk4vmrX21kxZlSLA,1254
16
+ pytbox/categraf/jinja2/__init__.py,sha256=Epm01j8Oujeg4Sk5GgHMvgKIZ6h3BTx-MGmuMgIjUMo,150
17
+ pytbox/categraf/jinja2/input.cpu/cpu.toml.j2,sha256=wxpyLDNvz2ViZK-0a4EgH35Zsg82CwMwijOtT0nBfTI,92
18
+ pytbox/categraf/jinja2/input.disk/disk.toml.j2,sha256=kOWwVF6u7x2huLVa4eBIOhC8R13DXmw0PD9o3HXwEZo,420
19
+ pytbox/categraf/jinja2/input.diskio/diskio.toml.j2,sha256=33E4L1mkUkJOocUsSgpW5zoFCzvx5ogfbnm2jkwzLx8,227
20
+ pytbox/categraf/jinja2/input.dns_query/dns_query.toml.j2,sha256=-oMkIMtCg4zq_oGENrm9aUzUzVkWmgxPSrGlwo2k2Pc,461
21
+ pytbox/categraf/jinja2/input.http_response/http_response.toml.j2,sha256=Qp1EOxx7TC7_cH69KqMVwbfCKrD5xbbVO2drVdkvo6s,317
22
+ pytbox/categraf/jinja2/input.mem/mem.toml.j2,sha256=_-qJyE0K_76IMehbN1xq1hi9vY1Y1Jp4TuITzaLjCg4,116
23
+ pytbox/categraf/jinja2/input.net/net.toml.j2,sha256=yodVoT1f7bcuNMFFmAvc7WhORUsTnM92IhpWQHXfY_U,279
24
+ pytbox/categraf/jinja2/input.net_response/net_response.toml.j2,sha256=Qp1EOxx7TC7_cH69KqMVwbfCKrD5xbbVO2drVdkvo6s,317
25
+ pytbox/categraf/jinja2/input.ping/ping.toml.j2,sha256=UCRy_IVoI_FDQxfsDpGS-aZJasFG1sf67ScN9U8YVIo,344
26
+ pytbox/categraf/jinja2/input.prometheus/prometheus.toml.j2,sha256=6ax30L1sAUreojlzf0v26GzOAiheCP0Lj7n5IIjgco0,384
27
+ pytbox/categraf/jinja2/input.snmp/cisco_interface.toml.j2,sha256=0u7eEoi4Q_NB8nnujq8a424r7GNB1eR8J3DToOhwWeQ,1941
28
+ pytbox/categraf/jinja2/input.snmp/cisco_system.toml.j2,sha256=DMJSEouhyGu54BIxehzsHQnnMgPHjnTweuVG0Y5iIw4,925
29
+ pytbox/categraf/jinja2/input.snmp/h3c_interface.toml.j2,sha256=0u7eEoi4Q_NB8nnujq8a424r7GNB1eR8J3DToOhwWeQ,1941
30
+ pytbox/categraf/jinja2/input.snmp/h3c_system.toml.j2,sha256=DMJSEouhyGu54BIxehzsHQnnMgPHjnTweuVG0Y5iIw4,925
31
+ pytbox/categraf/jinja2/input.snmp/huawei_interface.toml.j2,sha256=0u7eEoi4Q_NB8nnujq8a424r7GNB1eR8J3DToOhwWeQ,1941
32
+ pytbox/categraf/jinja2/input.snmp/huawei_system.toml.j2,sha256=DMJSEouhyGu54BIxehzsHQnnMgPHjnTweuVG0Y5iIw4,925
33
+ pytbox/categraf/jinja2/input.snmp/ruijie_interface.toml.j2,sha256=0u7eEoi4Q_NB8nnujq8a424r7GNB1eR8J3DToOhwWeQ,1941
34
+ pytbox/categraf/jinja2/input.snmp/ruijie_system.toml.j2,sha256=DMJSEouhyGu54BIxehzsHQnnMgPHjnTweuVG0Y5iIw4,925
35
+ pytbox/categraf/jinja2/input.vsphere/vsphere.toml.j2,sha256=7SCo8DSh5Uuy-7MeWw-soy6sqblK54k6K2WWSlimELk,8396
36
+ pytbox/cli/__init__.py,sha256=5ID4-oXrMsHFcfDsQeXDYeThPOuQ1Fl2x2kHWfgfOEw,67
37
+ pytbox/cli/main.py,sha256=CywsgiwQepM-mTGTnmDLcr9LHLhC2EYluCDU5NONFZI,394
38
+ pytbox/cli/categraf/__init__.py,sha256=HfhDhWiWEuT5e6fXb6fs7UgoZPwn9WQ1wdFoza2muaI,96
39
+ pytbox/cli/categraf/commands.py,sha256=M-coJaHhb5I9fMW7OMWe9SMrs_RmSm4hSIJ1CPS0Ipc,1874
40
+ pytbox/cli/commands/vm.py,sha256=K3Jf7dFI493raB5v4-SUmnUisVpfX1aQqOZkE5hDE60,559
41
+ pytbox/cli/common/__init__.py,sha256=1_OE4q6OIUQkpwXBWqiKHr7SXxEu925hRgmd2hulIy4,70
42
+ pytbox/cli/common/options.py,sha256=Xv1wXja-fdaQVY6_FzvYRrXDozeTOJV6BL8zYIKJE9k,773
43
+ pytbox/cli/common/utils.py,sha256=0uQ5L1l5cySFheixB91B9ptq0p6tGsBhqvvm3ouRGbI,9050
44
+ pytbox/cli/formatters/__init__.py,sha256=4o85w4j-A-O1oBLvuE9q8AFiJ2C9rvB3MIKsy5VvdfQ,101
45
+ pytbox/cli/formatters/output.py,sha256=h5WhZlQk1rjmxEj88Jy5ODLcv6L5zfGUhks_3AWIkKU,5455
46
+ pytbox/common/__init__.py,sha256=3JWfgCQZKZuSH5NCE7OCzKwq82pkyop9l7sH5YSNyfU,122
47
+ pytbox/database/mongo.py,sha256=AhJ9nCAQHKrrcL-ujeonOwEf3x2QkmT2VhoCdglqJmU,3478
48
+ pytbox/database/victoriametrics.py,sha256=iSgYLcINpWK3ry1fWoL32k65j91Ag49kNBWXYxW3NKA,15750
49
+ pytbox/feishu/client.py,sha256=kwGLseGT_iQUFmSqpuS2_77WmxtHstD64nXvktuQ3B4,5865
50
+ pytbox/feishu/endpoints.py,sha256=z3nPOZPC2JGDJlO7SusWBpRA33hZZ4Z-GBhI6F8L_u4,40240
51
+ pytbox/feishu/errors.py,sha256=79qFAHZw7jDj3gnWAjI1-W4tB0q1_aSfdjee4xzXeuI,1179
52
+ pytbox/feishu/helpers.py,sha256=jhSkHiUw4822QBXx2Jw8AksogZdakZ-3QqvC3lB3qEI,201
53
+ pytbox/feishu/typing.py,sha256=3hWkJgOi-v2bt9viMxkyvNHsPgrbAa0aZOxsZYg2vdM,122
54
+ pytbox/log/logger.py,sha256=t5LEvuYTDixh67JOyX0ke1ukb9kT5PEaUSsQnDDck90,8921
55
+ pytbox/log/victorialog.py,sha256=gffEiq38adv9sC5oZeMcyKghd3SGfRuqtZOFuqHQF6E,4139
56
+ pytbox/mail/alimail.py,sha256=njKA3PUbIaiKFaxKvUObmklmEEHg2YA-O5rpgsgT5_w,5147
57
+ pytbox/mail/client.py,sha256=RNgWhhTXFTpD43U4p7hbmnfRdmltuZmbm890gaZTzhI,6278
58
+ pytbox/mail/mail_detail.py,sha256=6u8DK-7WzYPSuX6TdicSCh2Os_9Ou6Rn9xc6WRvv85M,699
59
+ pytbox/network/meraki.py,sha256=OdT5PWNYiPcJfsQ4tMkjKSE22EH1xBHHG-vuv0L4jM8,20064
60
+ pytbox/utils/cronjob.py,sha256=b17CY1fmaFTdQojicXAXHliov_JZdmT7cZhtO4v5sCo,3080
61
+ pytbox/utils/env.py,sha256=gD2-NyL3K3Vg1B1eGeD1hRtlSHPGgF8Oi9mchuQL6_o,646
62
+ pytbox/utils/load_config.py,sha256=R4pGerBinbewsym41hQ8Z-I5I7gepuEKODjIrli4C08,5043
63
+ pytbox/utils/load_vm_devfile.py,sha256=GVbB-FvGb0l586SDaraz__ZaXyDWd1WxcXVw5xGfXWw,1328
64
+ pytbox/utils/response.py,sha256=kXjlwt0WVmLRam2eu1shzX2cQ7ux4cCQryaPGYwle5g,1247
65
+ pytbox/utils/richutils.py,sha256=Qy7DB8dowt2lINp07RfDCyd8EXpbdvlKslVnjiMn-5o,863
66
+ pytbox/utils/timeutils.py,sha256=YqPZC3DVm0RjIxesBZQfKkT6LlJcuJy1a1r3rHMveng,18366
67
+ pytbox/win/ad.py,sha256=-3pWfL3dElz-XoO4j4M9lrgu3KJtlhrS9gCWJBpafAU,1147
68
+ pytbox-0.3.1.dist-info/METADATA,sha256=2JNJeSTV8TvbLWDcbgalpqYnhBsbXzHspe-ORSksCyI,6319
69
+ pytbox-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
70
+ pytbox-0.3.1.dist-info/entry_points.txt,sha256=YaTOJ2oPjOiv2SZwY0UC-UA9QS2phRH1oMvxGnxO0Js,43
71
+ pytbox-0.3.1.dist-info/top_level.txt,sha256=YADgWue-Oe128ptN3J2hS3GB0Ncc5uZaSUM3e1rwswE,7
72
+ pytbox-0.3.1.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pytbox = pytbox.cli:main
pytbox/common/base.py DELETED
File without changes
pytbox/victoriametrics.py DELETED
@@ -1,37 +0,0 @@
1
- #!/usr/bin/env python3
2
-
3
- import requests
4
- from .utils.response import ReturnResponse
5
-
6
-
7
- class VictoriaMetrics:
8
-
9
- def __init__(self, url: str='', timeout: int=3) -> None:
10
- self.url = url
11
- self.timeout = timeout
12
- self.session = requests.Session()
13
- self.session.headers.update({
14
- 'Content-Type': 'application/json',
15
- 'Accept': 'application/json'
16
- })
17
-
18
- def query(self, query: str) -> ReturnResponse:
19
- '''
20
- 查询指标数据
21
-
22
- Args:
23
- query (str): 查询语句
24
-
25
- Returns:
26
- dict: 查询结果
27
- '''
28
- url = f"{self.url}/prometheus/api/v1/query"
29
- r = requests.get(
30
- url,
31
- timeout=self.timeout,
32
- params={"query": query}
33
- )
34
- if r.json().get("status") == "success":
35
- return ReturnResponse(code=0, msg=f"[{query}] 查询成功!", data=r.json()['data']['result'])
36
- else:
37
- return ReturnResponse(code=1, msg=f"[{query}] 查询失败: {r.json().get('error')}", data=r.json())
@@ -1,21 +0,0 @@
1
- pytbox/dida365.py,sha256=s6ipeweXMV3CaatFFwuxEwBLGK9jJ0B6GP7dQMYxpDo,10592
2
- pytbox/logger.py,sha256=4IHmMg14Rwekmc7AeKGDbsDZryhcD6elaJZsvpdYJ80,5659
3
- pytbox/onepassword_connect.py,sha256=nD3xTl1ykQ4ct_dCRRF138gXCtk-phPfKYXuOn-P7Z8,3064
4
- pytbox/onepassword_sa.py,sha256=08iUcYud3aEHuQcUsem9bWNxdXKgaxFbMy9yvtr-DZQ,6995
5
- pytbox/victorialog.py,sha256=50cVPxq9PzzzkzQHhgv_785K3GeF8B2mEnChdeekZWU,4137
6
- pytbox/victoriametrics.py,sha256=xYizUXeazVQM7-MT9wxhqtfol2fZrXjfrt1qRgDsTKU,1098
7
- pytbox/alicloud/sls.py,sha256=WZuxt6NjY3Sf9KMF4DoDlCoxbdqGL2lyymp6jQW-wJc,4355
8
- pytbox/common/__init__.py,sha256=3JWfgCQZKZuSH5NCE7OCzKwq82pkyop9l7sH5YSNyfU,122
9
- pytbox/common/base.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- pytbox/feishu/client.py,sha256=kwGLseGT_iQUFmSqpuS2_77WmxtHstD64nXvktuQ3B4,5865
11
- pytbox/feishu/endpoints.py,sha256=z_nHGXAjlIyYdFnbAWY4hfzzHrENJvoNOqY9sA6-FLk,40009
12
- pytbox/feishu/errors.py,sha256=79qFAHZw7jDj3gnWAjI1-W4tB0q1_aSfdjee4xzXeuI,1179
13
- pytbox/feishu/helpers.py,sha256=jhSkHiUw4822QBXx2Jw8AksogZdakZ-3QqvC3lB3qEI,201
14
- pytbox/feishu/typing.py,sha256=3hWkJgOi-v2bt9viMxkyvNHsPgrbAa0aZOxsZYg2vdM,122
15
- pytbox/utils/env.py,sha256=jO_-BKbGuDU7lIL9KYkcxGCzQwTXfxD4mIYtSAjREmI,622
16
- pytbox/utils/response.py,sha256=WAsA84VDyOTEaFl2jyGFNhAiYuoI-UHngb89AiUXD_U,1251
17
- pytbox/utils/timeutils.py,sha256=zMf6Oe7dc5oR-yyvMxznq8Jr78S_WRVmhg-Z7hJdypQ,979
18
- pytbox-0.0.1.dist-info/METADATA,sha256=aDRXMGyuwmnzJUjz1WGhGJU-VSXepcAnpvbrlWiZri0,6002
19
- pytbox-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
- pytbox-0.0.1.dist-info/top_level.txt,sha256=YADgWue-Oe128ptN3J2hS3GB0Ncc5uZaSUM3e1rwswE,7
21
- pytbox-0.0.1.dist-info/RECORD,,
File without changes