chrisboyke / jira_search_replace Goto Github PK
View Code? Open in Web Editor NEWSearch & Replace via Rest API for JIRA
Search & Replace via Rest API for JIRA
Atlassian has changed the way it wants us to send authentication headers.
they want the username:apikey encoded in base64 and that gets stuffed into "authorization: basic" header.
Actually I guess this is normal-ish for basic-auth..
here is their "help" page
https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/
here's how I did it and it seems to work:
auth_parts=(instance['user']+":"+instance['apikey']).encode('ascii')
auth_str=base64.b64encode(auth_parts).decode('ascii')
headers={'Authorization' : 'Basic '+auth_str,'Content-Type':'application/json'}
not being a python programmer I have just hacked this into your util.py in the "get_with_cache" and "do_post" "do_put" functions, so I'm sure you can design a more elegant way to integrate it.
Traceback (most recent call last):
File "jira_search_replace.py", line 87, in
main()
File "jira_search_replace.py", line 15, in main
issues=get_issues(config)
File "jira_search_replace.py", line 27, in get_issues
data=util.do_post(config['instance'],'search',post_data)
File "/scripts/jira_search_replace/util.py", line 60, in do_post
return handle_status(url,data,r)
File "/scripts/jira_search_replace/util.py", line 85, in handle_status
log_error(url,r.status_code,r.reason,r.text,json.dumps(data,indent=2))
File "/scripts/jira_search_replace/util.py", line 14, in log_error
f.write(arg+'\n')
TypeError: unsupported operand type(s) for +: 'int' and 'str'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.