Api call for filter

I have having a go at my first api call for a specific filter.
the url is fine when i open json via explorer, so no issue there.

i have the following error.

[WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions

with the following python code run via Sql Server management studio.

EXECUTE sp_execute_external_script @language = N’Python’
, @script = N’

import requests
from requests.auth import HTTPBasicAuth
import json

url = “https://domain/rest/api/3/search?jql=filter=11033&startAt=2&maxResults=100

auth = HTTPBasicAuth(“emailAddress”, “api key”)

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=(“,”, ": ")))

any idea anyone. ?

Hello @RobertDineen

I strongly recommend that you use an API test tool like Postman to validate all requests outside of your code first, before assuming a code fault.

Also, just try running your Python code directly, outside of SQL Server Management Studio to confirm if that environment is the cause of that obscure error, which sounds like some sort of port binding or routing problem.

OK then, i have tested this outside SSMS, and it works lovely.
so what would be the way forward to get it working in SSMS please?

I am using the sp_execute_external_script @language = N’Python’
, @script = N’ via SSMS.

has anyone been able to achieve this ?