I have a function that makes a GET request to the JIRA REST API to pull down the JSON object of a JIRA ticket.
It uses the requests module. But I don't want to use it anymore because anytime I want someone else to run my script, they need to jump through fiery hoops to get the requests module because they are behind a corporate proxy and they don't have the time to put in the extra work.
So instead of asking people to do something they don't have the patience or time to do, I'd much rather replace the requests module with something else so that this script is more of an out-of-the-box solution.
Here's what I have now:
import requests
import pprint
def pull_jira_info(jira, user, pw, url):
"""
Arguments:
jira - the JIRA issue number
url - the first part of the JIRA server url
user - JIRA username
pw - JIRA password
"""
url += '/rest/api/2/issue/' + jira
r = requests.get(url, auth=(user, pw), verify=False)
jira_info = r.json()
pprint.pprint(jira_info)
return jira_info
My guess is that I can do a simple swap of the requests module with some other module (built into python) that does GET requests without having to change too much code.
Does anyone have a simple go-to for this that isn't the requests module? What would that look like when implemented in the current function I have?