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()
- timetaken=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])
- timetaken.append(float(line.split(' ')[-2].replace('ms',"")))
- except IndexError:
- continue
- data={'date':date,"time":time ,'reequest ':request ,"path ":path ,"timetaken":timetaken}
- df = pd.DataFrame.from_dict(data=data,orient='index')
- df=df.transpose()
- df.to_csv('./timeout.csv')
- print(df.describe())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement