Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Python API update

Been searching around for a solid day and can't seem to find what I'm looking for. Trying to run a python script to update a single custom field on JIRA Service Desk. I originally wrote a script that worked :


from jira import JIRA

def main():

options = {'server': ''}
jira = JIRA(options, basic_auth=("jUSER", "API_Key"))
issue = jira.issue('GISSUE-123')

issue.update(fields={'customfield_10130': 'New Value'})

print (issue.fields.project.key)
print (
print (issue.fields.reporter.displayName)
print (issue.fields.summary)
print (

if __name__== "__main__" :


However I am unable to user the JIRA module in this environment for reasons. I can however use requests which led me to write:


import requests
from requests.auth import HTTPBasicAuth
import json

url = ""

auth = HTTPBasicAuth("USER", "KEY")

update = {'customfield_10130': 'New Value'}

headers = {"Accept": "application/json"}

x =, json=update, headers=headers, auth=auth)


BUt this doesn't seem to do anything. I'm probably configuring this wrong as I don't have much experience with the request module here. 

Any help or advice would be great!

1 answer

0 votes
Andy Heinzer Atlassian Team Dec 10, 2019

Hi Joe,

I see that you are trying to make some REST calls to Jira Cloud using python here.  I understand that the old script used to work, but I suspect that the Deprecation notice - Basic authentication with passwords and cookie-based authentication  likely is affecting this request attempt.  Eventhough it looks like you're using a REST API token instead of a password, in my experience we can't just pass that token in cleartext anymore.

Instead I believe you will need to consult with the Basic auth for REST APIs.  Essentially, I think you can make this work, but instead of trying to get the authorization with a username/token (which used to work), instead you need to create a string of


and then base64 encode that string.  You can then pass that string as part of an authorization header to make able to make an authenticated REST API request.

Try that approach instead.  Let me know if you run into any problems here.



Suggest an answer

Log in or Sign up to answer

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