Closed
Description
How do I check if github3 does not find resource?
for example:
import github3
g = github3.GitHub(token='mytoken')
i1 = g.issue('rmamba', 'sss3', 1) #exists, returns Issue
i2 = g.issue('rmamba', 'sss3', 1000) #does not exists, return NullObject
how do I do this:
if i is None:
handle none
I can do if i2 is i2.Empty
. But then with i1 it does not work because it returns valid issue and i1.Empty does not exist. I tried with NullObject but it always says it's false.
i1 is NullObject #false
i1 is NullObject('Issue') #false
so I had to do this for now:
if '%s' % i2 == '':
handle None
because it works for both NullObjects and valid results returned
Metadata
Metadata
Assignees
Labels
No labels