employee.py 699 B

1234567891011121314151617181920212223242526272829303132
  1. import requests
  2. class Employee:
  3. """A sample Employee class"""
  4. raise_amt = 1.05
  5. def __init__(self, first, last, pay):
  6. self.first = first
  7. self.last = last
  8. self.pay = pay
  9. @property
  10. def email(self):
  11. return '{}.{}@email.com'.format(self.first, self.last)
  12. @property
  13. def fullname(self):
  14. return '{} {}'.format(self.first, self.last)
  15. def apply_raise(self):
  16. self.pay = int(self.pay * self.raise_amt)
  17. def monthly_schedule(self, month):
  18. response = requests.get(f'http://company.com/{self.last}/{month}')
  19. if response.ok:
  20. return response.text
  21. else:
  22. return 'Bad Response!'