## python3 get_api_roots.py
### import requirements https://taxii2client.readthedocs.io/en/latest/api/taxii2client.v21.html#taxii2client.v21.Server
from stix2 import TAXIICollectionSource
from taxii2client import Server
# define server and get API Root
server = Server("https://cti-taxii.mitre.org/taxii/")
api_root = server.api_roots[0]
# Print name and ID of all ATT&CK domains available as collections
for collection in api_root.collections:
print(collection.title + ": " + collection.id)
But getting:
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 406 Client Error: Not Acceptable for url: https://cti-taxii.mitre.org/taxii/
I’ve played around with adding headers in the request manually to match TAXII spec, but alas, I cannot to figure out what’s missing from my request. Any pointers welcome…