Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import csv
- import pandas as pd
- from typing import *
- file = requests.get("http://ka-mao.xyz/log/rtime")
- content = file.text
- avg_resp_time = 0
- entry = 0
- data=dict()
- date=list()
- time=list()
- request=list()
- timeout=list()
- path=list()
- lines = content.split("\n")
- for line in lines:
- try:
- sep=line.split(' ')
- # print(sep[0])
- # print(sep[1])
- # print(sep[4])
- # print(sep[5])
- # print(sep[-2])
- date.append(sep[0].replace(',',''))
- time.append(sep[1])
- request.append(sep[4])
- path.append(sep[5])
- timeout.append(float(line.split(' ')[-2].replace('ms',"")))
- except IndexError:
- continue
- data=pd.DataFrame({'date':date,"time":time ,'reequest ':request ,"path ":path ,"timeout":timeout})
- data.to_csv('./timeout.csv')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement