Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Error while getting updated issues in json fromat using python API? Edited

hi 

i have python script polling jira for every 5 min .
updated_issues = jira.search_issues(f' project = {jira_project_key} and updated >= "-12h" ',json_result=True)       

  issues = updated_issues["issues"]
        for item in issues:        

              try:                                                jissue = JIRA_Issue.objects.get(jira_key=item['key'])         

   except JIRA_Issue.DoesNotExist:                

   continue          

  desc=''                  

if jissue.finding is not None:                     

jissue.finding.severity = item['fields']['customfield_10605']['value']                    desc = item['fields']['description']

 

 

i am getting this error

Traceback (most recent call last):


File "/usr/local/lib/python3.6/site-packages/jira/resources.py", line 161, in __getattr__


return self[item]

TypeError

'CustomFieldOption' object is not subscriptable


During handling of the above exception, another exception occurred:


Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/jira/resources.py", line 161, in __getattr__


[2021-03-16 06:09:03,360: WARNING/MainProcess] return self[item]


TypeError

 

1 answer

0 votes
Hana Kučerová Community Leader Mar 16, 2021

Hi @Akiti Bala ,

welcome to the Atlassian Community!

I'm not a python specialist, but after the quick check of your code, this line is suspicious for me:

jissue.finding.severity = item['fields']['customfield_10605']'value']

I believe it should be:

jissue.finding.severity = item['fields']['customfield_10605']['value']

(missing bracket) 

hi Hana,

i didnt notice it . i updated post 

Thanks .

Hana Kučerová Community Leader Mar 16, 2021

@Akiti Bala 

to be honest, it is complicated to understand, what you are trying to achieve.

Which line has number 161?

Which type has your customfield_10605? Select List (single choice)?

Could you please paste here the whole code?

Thank you.

HI @Hana Kučerová ,

The line 161 is in jira python client :

File "/usr/local/lib/python3.6/site-packages/jira/resources.py", line 161, in __getattr_

 

the custom_field_10605 is Severity choice .It may be High,Low,Medium,Info.
when i am trying to get custom field for updating local DB, it throws error .
Thanks

Hana Kučerová Community Leader Mar 17, 2021

I think this line

jissue.finding.severity = item['fields']['customfield_10605']['value']  

is causing the error: 'CustomFieldOption' object is not subscriptable

CustomFieldOption object is something, which is returned, when you get value from 

Select List (single choice) custom field.

Hopefully this article will help you to fix it.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you