OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

cti-users message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [EXT] [cti-users] Client Python Code


Hi Bret,

Thanks for getting back to me. However, The information you provided didn't help me out. I'm using the taxii2client code from here: https://github.com/oasis-open/cti-taxii-client

On line 484 of __init__.py there is a check that takes place. The snippet is as follows:

content_type = resp.headers['Content-Type']
if content_type != accept:
msg = "Unexpected Response Content-Type: {}"
raise TAXIIServiceException(msg.format(content_type))
return resp.json()

My execution goes into Unexpected Response Content-Type because the header from https://test.freetaxii.com:8000/taxii/ returns:

File "D:\Work\STIX_TAXII\taxii2client\__init__.py", line 484, in get raise TAXIIServiceException(msg.format(content_type)) taxii2client.TAXIIServiceException: Unexpected Response Content-Type: text/plain; charset=utf-8

I'm expecting something like:

MEDIA_TYPE_STIX_V20 = "application/vnd.oasis.stix+json; version=2.1; charset=utf-8"

The discovery server returned what I was expecting last night. Now it is giving me "text/plain".

Thanks!
Jason

On Tue, Nov 7, 2017 at 11:31 AM, Bret Jordan <Bret_Jordan@symantec.com> wrote:

Jason,


When making a request to the TAXII server, for TAXII resources like discovery, API roots, collections, etc you need to use the TAXII media type, aka "application/vnd.oasis.taxii+json".  


When you make a request at the objects resource, you need to use a STIX media type, aka "application/vnd.oasis.stix+json"


Let me know if that helps.


Bret


From: cti-users@lists.oasis-open.org <cti-users@lists.oasis-open.org> on behalf of Jason A. Evans <jasonevans77@gmail.com>
Sent: Tuesday, November 7, 2017 7:30:39 AM
To: cti-users@lists.oasis-open.org
Subject: [EXT] [cti-users] Client Python Code
 
I had some Python client code working last night. Making the following minor change:

MEDIA_TYPE_STIX_V20 = "application/vnd.oasis.stix+json; version=2.1; charset=utf-8"

With this change, I was able to call get_objects() as well as get_object(id).

However, this morning the following response is being returned:

File "D:\Work\STIX_TAXII\taxii2client\__init__.py", line 484, in get
    raise TAXIIServiceException(msg.format(content_type))
taxii2client.TAXIIServiceException: Unexpected Response Content-Type: text/plain; charset=utf-8

I can modify MEDIA_TYPE_STIX_V20 to match what is returned, but it only gets me to a future error where it looks like json is expected, not plain text.

Anyone else experiencing this?



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]