fix way to long timeout for connect

update poetry lock file
master
Maximilian Zettler 4 years ago
parent 98f6a88fe6
commit d81471969e
  1. 16
      poetry.lock
  2. 1
      pyproject.toml
  3. 2
      timebot/gui.py
  4. 19
      timebot/timebot.py

16
poetry.lock generated

@ -30,7 +30,7 @@ python-versions = "*"
[[package]]
name = "charset-normalizer"
version = "2.0.11"
version = "2.0.12"
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
category = "main"
optional = false
@ -82,7 +82,7 @@ python-versions = ">=3.5"
[[package]]
name = "nuitka"
version = "0.6.19.5"
version = "0.6.19.7"
description = "Python compiler with full language support and CPython compatibility"
category = "dev"
optional = false
@ -203,7 +203,7 @@ use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"]
[[package]]
name = "typing-extensions"
version = "4.0.1"
version = "4.1.1"
description = "Backported and Experimental Type Hints for Python 3.6+"
category = "dev"
optional = false
@ -261,8 +261,8 @@ certifi = [
{file = "certifi-2021.10.8.tar.gz", hash = "sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872"},
]
charset-normalizer = [
{file = "charset-normalizer-2.0.11.tar.gz", hash = "sha256:98398a9d69ee80548c762ba991a4728bfc3836768ed226b3945908d1a688371c"},
{file = "charset_normalizer-2.0.11-py3-none-any.whl", hash = "sha256:2842d8f5e82a1f6aa437380934d5e1cd4fcf2003b06fed6940769c164a480a45"},
{file = "charset-normalizer-2.0.12.tar.gz", hash = "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"},
{file = "charset_normalizer-2.0.12-py3-none-any.whl", hash = "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df"},
]
colorama = [
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
@ -281,7 +281,7 @@ more-itertools = [
{file = "more_itertools-8.12.0-py3-none-any.whl", hash = "sha256:43e6dd9942dffd72661a2c4ef383ad7da1e6a3e968a927ad7a6083ab410a688b"},
]
nuitka = [
{file = "Nuitka-0.6.19.5.tar.gz", hash = "sha256:b100789ea71aff8814cf52958e20f82c4c5a01aaa8a8eca38cd6a7e1cc5cae25"},
{file = "Nuitka-0.6.19.7.tar.gz", hash = "sha256:15f9618f3536b9933fe0e621ecfc8cb6ec0893cf23ef28be95392ac192a464be"},
]
packaging = [
{file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"},
@ -344,8 +344,8 @@ requests = [
{file = "requests-2.27.1.tar.gz", hash = "sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61"},
]
typing-extensions = [
{file = "typing_extensions-4.0.1-py3-none-any.whl", hash = "sha256:7f001e5ac290a0c0401508864c7ec868be4e701886d5b573a9528ed3973d9d3b"},
{file = "typing_extensions-4.0.1.tar.gz", hash = "sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e"},
{file = "typing_extensions-4.1.1-py3-none-any.whl", hash = "sha256:21c85e0fe4b9a155d0799430b0ad741cdce7e359660ccbd8b530613e8df88ce2"},
{file = "typing_extensions-4.1.1.tar.gz", hash = "sha256:1a9462dcc3347a79b1f1c0271fbe79e844580bb598bafa1ed208b94da3cdcd42"},
]
urllib3 = [
{file = "urllib3-1.26.8-py2.py3-none-any.whl", hash = "sha256:000ca7f471a233c2251c6c7023ee85305721bfdf18621ebff4fd17a8653427ed"},

@ -7,7 +7,6 @@ readme = "README.md"
[tool.poetry.scripts]
timebot = 'timebot.app:run'
gtimebot = 'timebot.gui:run'
[tool.poetry.dependencies]
python = "^3.6"

@ -131,7 +131,7 @@ class TimebotMainWindow(QWidget):
self.update_status_running = False
def update_hours_present(self, override=None):
if override:
if override is not None:
self.hours_present: datetime.timedelta = override
elif self.hours_present > datetime.timedelta(seconds=self.main_window_timer_time / 100):
self.hours_present = self.hours_present + datetime.timedelta(seconds=1)

@ -77,7 +77,7 @@ class MobatimeApi:
self.logger.warning(e) # file does not exist... ignored
except (EOFError, pickle.UnpicklingError) as e:
self.logger.warning(e) # file seems to be corrupt... ignoring
request = self._session.get(self.baseurl + "Employee/GetEmployeeList")
request = self._session.get(self.baseurl + "Employee/GetEmployeeList", timeout=2)
if 400 <= request.status_code < 500:
self.logger.debug(f"got error {request.status_code}... trying to log in")
self._login(self._session)
@ -104,8 +104,9 @@ class MobatimeApi:
}
session.cookies.clear_session_cookies()
session.post(self.baseurl + "Account/LogOn",
data=login_data).raise_for_status() # This always gives 200 ... even with wrong password
session.get(self.baseurl + "Employee/GetEmployeeList").raise_for_status()
data=login_data,
timeout=2).raise_for_status() # This always gives 200 ... even with wrong password
session.get(self.baseurl + "Employee/GetEmployeeList", timeout=2).raise_for_status()
@staticmethod
def _get_password():
@ -162,7 +163,7 @@ class MobatimeApi:
List all employees which are obviously in the same team as you.
:return: list of employees
"""
request = self.session.get(self.baseurl + "Employee/GetEmployees")
request = self.session.get(self.baseurl + "Employee/GetEmployees", timeout=2)
request.raise_for_status()
return request.json()
@ -172,7 +173,7 @@ class MobatimeApi:
:return: all user information as dict
"""
request = self.session.get(self.baseurl + "Employee/GetUserProfileForCurrentUser")
request = self.session.get(self.baseurl + "Employee/GetUserProfileForCurrentUser", timeout=2)
request.raise_for_status()
return request.json()
@ -196,7 +197,7 @@ class MobatimeApi:
}
if note:
entry_data["note"] = note
request = self.session.post(self.baseurl + "Entry/SaveEntry", data=entry_data)
request = self.session.post(self.baseurl + "Entry/SaveEntry", data=entry_data, timeout=2)
return request
def get_entries(self, entries: Union[str, None] = 10,
@ -230,7 +231,7 @@ class MobatimeApi:
"operator": "lte",
"value": end_date.strftime(DateFormats.SIMPLE_DATETIME.value),
})
request = self.session.post(self.baseurl + "Entry/GetEntries", json=filters)
request = self.session.post(self.baseurl + "Entry/GetEntries", json=filters, timeout=2)
request.raise_for_status()
return request.json()["data"]
@ -247,7 +248,7 @@ class MobatimeApi:
:return: dict of the info mentioned above
"""
request = self.session.get(self.baseurl + "Tracking/GetTrackingData")
request = self.session.get(self.baseurl + "Tracking/GetTrackingData", timeout=2)
request.raise_for_status()
return request.json()
@ -260,7 +261,7 @@ class MobatimeApi:
:return: list with mentioned infos
"""
request = self.session.get(self.baseurl + "Employee/GetAccountInformation")
request = self.session.get(self.baseurl + "Employee/GetAccountInformation", timeout=2)
request.raise_for_status()
return request.json()

Loading…
Cancel
Save