Ejemplo n.º 1
0
 def get_daily_usage(self):
     url = "https://minside-mbb.ice.no/Subscription/UsageDetails"
     response = self.do_request(url, params={"sub": self.subscription_id})
     html = response.text
     soup = bs4.BeautifulSoup(html, 'html.parser')
     div = soup.find("div", {"class": "day"})
     rows = div.find("tbody").findChildren("tr")
     data = []
     for row in rows:
         date, download, upload, total = [
             column.text for column in row.findChildren("td")
         ]
         date = datetime.datetime.strptime(date, "%d.%m.%Y")
         download = utils.human_to_bytes(download)
         upload = utils.human_to_bytes(upload)
         total = utils.human_to_bytes(total)
         data.append([date, download, upload, total])
     return data
Ejemplo n.º 2
0
 def parse_size(self, key, value):
     return _utils.human_to_bytes(value)