API: https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/comment
python script:
url = "https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}"
auth = HTTPBasicAuth("email@example.com", "<api_token>")
headers = {
"Accept": "application/json"
}
response = requests.request(
"GET",
url,
headers=headers,
auth=auth
)
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
Error
Update1
File "test.py", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
Update2
Install requests
then get another issue, please check the pic. And I try to install json
via python -m pip install json
but cannot do this.
you are missing an import statement.
at the top of the script try adding:
import requests
from requests.auth import HTTPBasicAuth
import json
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.