Python Forum
Use function, retry until valid
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use function, retry until valid
#6
finally will run every time the try/except block is evaluated. You only want to return a value if JIRA._get_user_id() is successful.
def searchUser(userstring):
    while True:
        try:
            return JIRA._get_user_id(userstring)
        except:
            userstring = input("Please enter a valid user: ")
 
 
teamlead = "Teamleader_DisplayName"
teamlead = searchUser(teamlead)
 
departmentlead = "Departmentlead_DisplayName"
departmentlead = searchUser(departmentlead)
Methods that start with an underscore indicate that the method is not meant for public use. The package authors are warning you thatJIRA._get_user_id() can change at any time and it is unwise for you to use this method in your code.
Ashcora likes this post
Reply


Messages In This Thread
Use function, retry until valid - by Ashcora - Jan-05-2023, 10:18 AM
RE: Use function, retry until valid - by deanhystad - Jan-05-2023, 01:21 PM
RE: Use function, retry until valid - by Ashcora - Jan-05-2023, 03:13 PM
RE: Use function, retry until valid - by jefsummers - Jan-05-2023, 04:08 PM
RE: Use function, retry until valid - by Ashcora - Jan-05-2023, 04:18 PM
RE: Use function, retry until valid - by deanhystad - Jan-05-2023, 05:30 PM
RE: Use function, retry until valid - by Ashcora - Jan-05-2023, 09:19 PM
RE: Use function, retry until valid - by deanhystad - Jan-05-2023, 10:19 PM
RE: Use function, retry until valid - by Ashcora - Jan-06-2023, 10:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  is this a valid variable name? Skaperen 5 261 Yesterday, 03:02 AM
Last Post: snippsat
  Script getting reindexing only valid error cubangt 1 1,249 Dec-07-2023, 04:06 PM
Last Post: cubangt
  How to ignore "Retrying (Retry(total=2, connect=2, read=5, redirect=5, status=None))" const 3 2,861 Mar-26-2022, 08:55 AM
Last Post: ndc85430
  checking for valid hexadecimal digits Skaperen 3 6,622 Sep-02-2021, 07:22 AM
Last Post: buran
  requests_futures.sessions retry list of HTTP 429 Johanoosterwaal 0 1,605 Nov-20-2020, 09:23 PM
Last Post: Johanoosterwaal
  Retry After Exception Harshil 2 2,334 Aug-09-2020, 05:32 PM
Last Post: Harshil
  Limiting valid values for a variable in a class WJSwan 5 3,826 Jul-06-2020, 07:17 AM
Last Post: Gribouillis
  How to verify the give number is valid Mekala 3 2,510 May-16-2020, 02:40 PM
Last Post: anbu23
  C:\Windows\System32\appwiz.cpl is not a valid Win32 application Marceepoo 8 5,347 Mar-15-2020, 04:46 AM
Last Post: buran
  is a str object a valid iterator? Skaperen 6 5,812 Jan-27-2020, 08:44 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020