python_wiki:exceptions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
python_wiki:exceptions [2017/09/17 00:14]
billdozor [Exceptions]
python_wiki:exceptions [2019/05/25 23:50] (current)
Line 54: Line 54:
   exit(1)   exit(1)
 </code> </code>
 +
 +\\
 +Another example is using a try, except when using an API for logins.
 +<code python>
 +# Attempt to login and get a session id
 +try:
 +  key = server.auth.login(spacewalk_login, spacewalk_password)
 +except:
 +  print("->ERROR: Spacewalk Login failed. Exiting...")
 +  exit(1)
 +</code>
 +  * NOTE: The above code will not run by itself, as it is a snippet from using a Spacewalk API.
  
 ---- ----
  
  • python_wiki/exceptions.1505621663.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)