SysInfo.py 643 B

12345678910111213141516171819202122232425
  1. import os
  2. import sys
  3. import requests
  4. import shutil
  5. class Informator:
  6. def __init__(self):
  7. self.ip = requests.get("https://ident.me").text
  8. self.info()
  9. def info(self):
  10. response = requests.get(f'http://ipinfo.io/{self.ip}/json')
  11. self.user_country = response.json()['country']
  12. self.user_timezone = response.json()['timezone']
  13. return [self.ip,self.user_country]
  14. def getRegion(self):
  15. return self.user_country
  16. def getTimezone(self):
  17. return self.user_timezone
  18. def getFreeDiskSpace(self):
  19. total, used, free = shutil.disk_usage(__file__)
  20. return free