make mypy happy

This commit is contained in:
Maximilian Hils 2019-11-16 13:54:44 +01:00 committed by GitHub
parent a799fddee1
commit d17b9d6230
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@ from mitmproxy.utils import strutils
def cleanup_request(f: flow.Flow) -> http.HTTPRequest:
if not hasattr(f, "request") or not f.request:
if not getattr(f, "request", None):
raise exceptions.CommandError("Can't export flow with no request.")
assert isinstance(f, http.HTTPFlow)
request = f.request.copy()
@ -28,7 +28,7 @@ def cleanup_request(f: flow.Flow) -> http.HTTPRequest:
def cleanup_response(f: flow.Flow) -> http.HTTPResponse:
if not hasattr(f, "response") or not f.response:
if not getattr(f, "response", None):
raise exceptions.CommandError("Can't export flow with no response.")
assert isinstance(f, http.HTTPFlow)
response = f.response.copy() # type: ignore