promotion/ops/reflush_ad.py
2019-10-09 15:34:33 +08:00

30 lines
717 B
Python

# -*- coding: utf-8 -*-
from prod_config import priv_i_port
from log.mylog import define_logger
import logging
import requests
define_logger("/data/logs/ad/rebuild_ad.log")
log = logging.getLogger(__name__)
def rebuild_ad():
ra = Reflush_AdInfo()
if ra.reflush():
return True
else:
return False
# http://154.8.214.202:6015/interface/reflush_adinfo
class Reflush_AdInfo():
def __init__(self):
self.url = f"http://127.0.0.1:{priv_i_port}/interface/reflush_adinfo"
def reflush(self):
r = requests.get(self.url)
log.info(f"reflush {self.url} {r.status_code}")
if r.status_code == 200:
return True
else:
return False