oasis-open / cti-taxii-client

OASIS TC Open Repository: TAXII 2 Client Library Written in Python
https://taxii2client.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
108 stars 52 forks source link

406 Client Error: Not Acceptable for URL #80

Closed stianvale closed 4 years ago

stianvale commented 4 years ago

Hi! I'm trying to access ATT&CK data through the stix2 and taxiiclient package. However I'm getting the following error: "406 Client Error: Not Acceptable for url: https://cti-taxii.mitre.org/stix/collections/95ecc380-afe9-11e4-9b6c-751b66dd541e/"

I'm trying to run this snippet:

from stix2 import TAXIICollectionSource
from taxii2client import Server

server = Server("https://cti-taxii.mitre.org/taxii/")
api_root = server.api_roots[0]

What am I missing? Do I need to set something up first?

Thanks in advance!

emmanvg commented 4 years ago

Hi @stianvale, you are only missing one detail. The taxii2client library is built to support multiple versions of the TAXII Specification . Once the document is approved as a Committee Specification (CS) we will write support for it and it will be available on our next release typically as a major release since it breaks backwards compatibility when developers use the implicit import method from taxii2client import Server.

Don't worry even on the latest version of the distributable we keep the functionality to still communicate with TAXII Servers implementing an older version of the specification via the v2X import (view in our API). Which is recommended for large scale applications needing to stick to a particular version of TAXII.

Therefore the recommendation is:

from stix2 import TAXIICollectionSource
from taxii2client.v20 import Server

server = Server("https://cti-taxii.mitre.org/taxii/")
api_root = server.api_roots[0]

If in the future that server is implemented as a TAXII 2.1 Server the only change you need to make on your end is .v20 -> .v21 or similar.

You might find these discussions relevant: https://github.com/mitre/cti/issues/104 https://github.com/mitre/cti/issues/103

Hope this helps!

stianvale commented 4 years ago

Hi @emmanvg ! Thanks a lot, that worked!