from flask import Flask import pycurl from io import StringIO import time from DBSession import session_maker from model import InstanceList app = Flask(__name__) from utils import * def test(): return ipaddr def h5_curl(): c = pycurl.Curl() c.setopt(pycurl.URL, "https://longvideoh5.piaoquantv.com/core/share?shareSource=customerMessage&fromAppType=0&qrAppType=0&versionCode=321&shareUid=12463024&shareMachineCode=weixin_openid_o0w175fPwp8yrtOGihYJhvnT9Ag4&h5WxrootPageSource=vlog-pages___category&videoId=2689415&isRecommendShare=1&h5ShareId=backend493cd67dd28f4ee395781d59881567211625976055926&shareDepth=0&state=/") c.setopt(pycurl.HTTPHEADER, ["Accept:"]) c.setopt(pycurl.WRITEFUNCTION, StringIO.write) c.setopt(pycurl.FOLLOWLOCATION, 1) c.setopt(pycurl.MAXREDIRS, 5) c.perform() info = c.getinfo(pycurl.INFO_FILETIME) print(info) if __name__ == '__main__': # with session_maker() as session: # instance_info = session.query(InstanceList).filter(InstanceList.status==0).all() # for index in range(len(instance_info)): # print( instance_info[index].ipadd) requestUri_list = [ 'longvideoapi/sys/config', 'longvideoapi/video/played', 'longvideoapi/video/shared/weixin/friend', 'longvideoapi/user/login/v2', 'longvideoapi/user/info/getUserInfoExt', 'longvideoapi/user/token/check', 'longvideoapi/user/token/refresh', 'longvideoapi/user/info/homepageHead', 'longvideoapi/user/share/homepage/circle', 'longvideoapi/user/idols', 'longvideoapi/user/fans', 'longvideoapi/user/recommend/list/v4', 'longvideoapi/user/outside/subscribeBatch', 'longvideoapi/user/info/getBaseUserInfo', 'longvideoapi/user/info/getTargetBaseUserInfo', 'longvideoapi/user/getWxUserInfoByCode', 'longvideoapi/user/follow', 'longvideoapi/user/unfollow', 'longvideoapi/video/favorite', 'longvideoapi/video/unfavorite', 'longvideoapi/video/shared/weixin/circle', 'longvideoapi/videoCollection/loadUserVideoCollections', 'longvideoapi/video/v2/sharePage/queryVideosByCollectionId', 'longvideoapi/video/v2/detailPage/queryVideosByCollectionId', 'longvideoapi/videoCollection/loadUserVideoCollectionsForShareOrDetailPage', 'longvideoapi/video/distribute/getAppInfo', 'longvideoapi/video/distribute/category/videoList/v2', 'longvideoapi/video/v2/followed', 'longvideoapi/video/v2/loadHotVideosByCollectionId', 'longvideoapi/video/v2/loadLatelyVideosByCollectionId', 'longvideoapi/video/v2/detail', 'longvideoapi/video/v2/sharePageDetail', 'longvideoapi/video/send', 'longvideoapi/video/getCoverImagePaths', 'longvideoapi/video/updateVideo', 'longvideoapi/video/deleteVideo', 'longvideoapi/video/barrage/send', 'longvideoapi/video/barrage/switch', 'longvideoapi/video/videoActionReport', 'longvideoapi/video/barrage/v2/list', 'longvideoapi/video/shared/h5"', 'longvideoapi/user/share/report', 'longvideoapi/oss/signature', 'longvideoapi/oss/completeUpload', 'longvideoapi/oss/producevideo/getStsToken', 'longvideoapi/operate/message/list', 'longvideoapi/video/message/list', 'longvideoapi/sys/message/list', 'longvideoapi/user/station/message/statistics/info', 'longvideoapi/user/station/message/statistics/read', 'longvideoapi/user/station/message/totalCount/v2', 'longvideoapi/user/station/message/totalRead', 'longvideoapi/user/station/notice/list', 'longvideoapi/user/station/message/share/list', 'longvideoapi/user/station/message/prise/list', 'longvideoapi/user/station/message/favorite/list', 'longvideoapi/user/station/message/comment/list', 'longvideoapi/user/station/message/barrage/list', 'longvideoapi/operation/message/list', 'longvideoapi/search/userandvideo/list', 'longvideoapi/search/tips', 'longvideoapi/search/user/list', 'longvideoapi/search/video/list', 'longvideoapi/search/hot/words', 'longvideoapi/search/hot/videos', 'longvideoapi/video/distribute/search/recommendVideoes/v2', 'longvideoapi/comment/top/save', 'longvideoapi/comment/top/page', 'longvideoapi/comment/praise', 'longvideoapi/comment/second/save', 'longvideoapi/comment/second/page', 'longvideoapi/comment/delete', 'longvideoapi/comment/updelete', 'longvideoapi/comment/hots', 'longvideoapi/bank/withdraw/getBankWithdrawConfig', 'longvideoapi/bank/withdraw/getBankWithdrawRecordList', 'longvideoapi/bank/withdraw/wxSamllapp/requestWithdraw', 'longvideoapi/purchase/video/list', 'longvideoapi/profits/myself/head', 'longvideoapi/profits/myself/list', 'longvideoapi/profits/myself/recordList/v2', 'longvideoapi/profits/reward/recordListAccordingToUser', 'longvideoapi/profits/reward/recordListAccordingToVideo', 'longvideoapi/video/reward/getVideoRewardHeadInfo', 'longvideoapi/video/reward/getVideoRewardRecordList', 'longvideoapi/video/reward/getVideoRewardConfig', 'longvideoapi/video/reward/getVideoRewardConfig/v2', 'longvideoapi/order/updateClientPayStatus', 'longvideoapi/order/purchase', 'longvideoapi/profits/videoPay/head', 'longvideoapi/profits/videoPay/list', 'longvideoapi/video/getPayedVideoPath', 'longvideoapi/order/reward', 'longvideoapi/video/reward/getVideoDetailRewardInfo', 'longvideoapi/video/recommend/detailPage/list', 'longvideoapi/video/recommend/sharePage/list', 'longvideoapi/measure/report/view', 'longvideoapi/video/validatePwd"', 'longvideoapi/video/validatePwdAuth"', 'longvideoapi/video/v2/getCutVideo', 'longvideoapi/frontConfig/getWxFrontConfig', 'longvideoapi/frontConfig/getVideoPlayConfig', 'longvideoapi/frontConfig/getUserFrontConfig', 'longvideoapi/rhythmapp/homepage/getAllVideos', 'longvideoapi/ad/position/info' ] # for i in range(len(instance_info["Instances"]["Instance"])): # instance_id = instance_info["Instances"]["Instance"][i]["InstanceId"] # ipaddr = instance_info["Instances"]["Instance"][i]["VpcAttributes"]["PrivateIpAddress"]["IpAddress"][0] # server_name = instance_info["Instances"]["Instance"][i]["Tags"]["Tag"][0]["TagValue"] # status = instance_info["Instances"]["Instance"][i]["Status"] # instance_name = instance_info["Instances"]["Instance"][i]["HostName"] # if status == "running": # # status = 1 # for url in requestUri_list: # IntfaceInfo = None # IntfaceInfo = IntfaceList() # with session_maker() as session: # IntfaceInfo.app_type = "1" # IntfaceInfo.interface_url = url # session.add(IntfaceInfo) # # # c = pycurl.Curl() # c.setopt(pycurl.URL, "https://longvideoh5.piaoquantv.com/core/share?shareSource=customerMessage&fromAppType=0&qrAppType=0&versionCode=321&shareUid=12463024&shareMachineCode=weixin_openid_o0w175fPwp8yrtOGihYJhvnT9Ag4&h5WxrootPageSource=vlog-pages___category&videoId=2689415&isRecommendShare=1&h5ShareId=backend493cd67dd28f4ee395781d59881567211625976055926&shareDepth=0&state=/") # c.setopt(pycurl.HTTPHEADER, ["Accept:"]) # b = StringIO.StringIO() # c.setopt(pycurl.WRITEFUNCTION, b.write) # c.setopt(pycurl.FOLLOWLOCATION, 1) # c.setopt(pycurl.MAXREDIRS, 5) # c.perform() # # # info = c.getinfo(pycurl.INFO_FILETIME) # # print(info) # with open("/t3.txt", "r") as f: # 打开文件 # data = f.read() # 读取文件 # # print(data) # 20210716000000000111111 # 20210726200800000000000 # start_time = int(time.strftime("%Y%m%d%H%M", time.localtime())) * 100000000000 # end_time = (int(time.strftime("%Y%m%d%H%M", time.localtime())) + 5) * 100000000000 # print(start_time , end_time) appType = ['0', '4', '5', '6', '12' ,'15'] for index in range(len(appType)): # qps = count_qps(url, appType[index]) print(appType[index])