Skip to content

Commit

Permalink
Added write timeout check per FaradayRF#30, fixed wording errors in r…
Browse files Browse the repository at this point in the history
…ead timeout

* Added writetimeout checks similar to readtimeout
* Fixed read timeout notes to remove copy/paste errors
  • Loading branch information
kb1lqc committed Mar 11, 2018
1 parent 03b6067 commit 4c587ac
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions faradayio_cli/faradayio_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,23 @@ def checkUserInput(args):
if not isinstance(args.timeout, int):
if not isinstance(args.timeout, type(None)):
# TODO: Likely cannot be NoneType yet per argparse design
raise TypeError("id must be an integer or Nonetype")
# Expect a value between 68-65535 per RFC 791
raise TypeError("read timeout must be an integer or Nonetype")
# Expect a value greater than zero
if isinstance(args.timeout, int):
if not 0 <= args.mtu
raise ValueError("read timeout must be a positive value")

# Check write timeout
# Expect and integer
if not isinstance(args.writetimeout, int):
if not isinstance(args.writetimeout, type(None)):
# TODO: Likely cannot be NoneType yet per argparse design
raise TypeError("write timeout must be an integer or Nonetype")
# Expect a value greater than zero
if isinstance(args.writetimeout, int):
if not 0 <= args.mtu
raise ValueError("write timeout must be a positive value")




Expand Down

0 comments on commit 4c587ac

Please sign in to comment.