Skip to content

Commit

Permalink
chore: fixed some errors when artifacts run
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlancehu committed Jan 26, 2023
1 parent 520a645 commit 0e166b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Lance
Copyright (c) 2023 Lance

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
20 changes: 12 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
import requests
import json
from sys import exit
from tencentcloud.common import credential
from tencentcloud.common.profile.client_profile import ClientProfile
from tencentcloud.common.profile.http_profile import HttpProfile
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.lighthouse.v20200324 import lighthouse_client, models

# Init
needupdate = False
checkpassing = True
# Get config
try:
with open('config.json', 'r') as f:
config = json.load(f)
f.close()
open('config.json', 'r')
except FileNotFoundError:
print('Config file not found')
exit()

except FileExistsError:
print('Config file exists error')
exit()
with open('config.json', 'r') as f:
config = json.load(f)
f.close()
# Get IP
if 'GetIPAPI' in config:
if config['GetIPAPI'] == "LanceAPI":
Expand Down Expand Up @@ -56,14 +61,14 @@
exit()



# Get Firewall Rules
try:
httpProfile = HttpProfile()
httpProfile.endpoint = "lighthouse.tencentcloudapi.com"
clientProfile = ClientProfile()
clientProfile.httpProfile = httpProfile
client = lighthouse_client.LighthouseClient(cred, InstanceRegion, clientProfile)
client = lighthouse_client.LighthouseClient(
cred, InstanceRegion, clientProfile)
req = models.DescribeFirewallRulesRequest()
params = {
"InstanceId": InstanceId,
Expand All @@ -78,7 +83,6 @@
exit()



# Modify Firewall Rules
for a in range(0, len(resp)):
for b in range(0, len(config['Rules'])):
Expand Down Expand Up @@ -112,4 +116,4 @@
print(err)
exit()
elif needupdate == False:
print("IP相同 无需更新")
print("IP相同 无需更新")

0 comments on commit 0e166b4

Please sign in to comment.