Problem Summary
Facing HTTP 415 error with Jira-Python basic auth in Python 2.7. Tried modifying session setup. Example below demonstrates alternative login:
import requests
def connect_to_jira(api_endpoint, username, password):
session_obj = requests.Session()
session_obj.auth = (username, password)
return session_obj.get(api_endpoint)
result = connect_to_jira('http://jira.example.com', 'user123', 'pass123')
print(result.text)
In my experience, HTTP 415 errors are often a sign of mismatched content types between what your client sends and what the server expects. I faced a similar issue when using Python 2.7 with jira-python. I found that tweaking the request headers was crucial. Instead of relying solely on the basic session configuration, I set the Content-Type explicitly in the request. Despite Python 2.7 having its quirks, ensuring the correct headers and verifying that the authentication mechanism is compatible with the API version helped me resolve the error. It may be worthwhile to log the actual request sent to compare with the API requirements.