mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 12:57:50 +08:00
优化
This commit is contained in:
@@ -23,13 +23,16 @@ class CloudFlareAPI(Query):
|
|||||||
query from source
|
query from source
|
||||||
"""
|
"""
|
||||||
account_id_resp = self.get(self.addr + 'accounts')
|
account_id_resp = self.get(self.addr + 'accounts')
|
||||||
|
if account_id_resp:
|
||||||
if account_id_resp.status_code != 200:
|
if account_id_resp.status_code != 200:
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
return
|
||||||
account_id = account_id_resp.json()['result'][0]['id']
|
account_id = account_id_resp.json()['result'][0]['id']
|
||||||
# query domain zone, if it not exist, create
|
# query domain zone, if it not exist, create
|
||||||
zones_resp = self.get(self.addr + 'zones',
|
zones_resp = self.get(self.addr + 'zones',
|
||||||
params={'name': self.domain}, check=False)
|
params={'name': self.domain}, check=False)
|
||||||
|
if zones_resp:
|
||||||
if zones_resp.status_code == 200:
|
if zones_resp.status_code == 200:
|
||||||
if zones_resp.json()['success'] and not zones_resp.json()['result']:
|
if zones_resp.json()['success'] and not zones_resp.json()['result']:
|
||||||
zone_id = self.create_zone(account_id)
|
zone_id = self.create_zone(account_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user