Skip to content

Data retrieval from the TAXII server with a TAXII client #101

Description

@ManuelZe

I am currently experiencing the same problem currently. But with version 2.1 of Taxii. Except that for me, I have

Content-Type: 'text / plain' for Accept: 'application / taxii + json; version = 2.1'
If you are trying to contact a TAXII 2.0 Server use 'from taxii2client.v20 import X'
If you are trying to contact a TAXII 2.1 Server use 'from taxii2client.v21 import X'

Could someone help me please?

I am using the medallion for TAXII server configuration.
As well as data extraction with the TAXII client developed by OASIS

Here is the data extraction code

`
from django.shortcuts import render

from taxii2client.v21 import Server
import requests
from taxii2client.v21 import Collection, as_pages

HEADERS = { 'Accept: application/taxii+json;version=2.1'}

def getinfo(request):
server = Server(url = 'http://127.0.0.1:5000/taxii2/', user='admin', password='Password0')

p = print(server.title)
p = print(server.description)

# Performing TAXII 2.0 Requests
# ---------------------------------------------------------------- #
# Performing TAXII 2.1 Requests
from taxii2client.v21 import Collection, as_pages

collection = Collection(url = 'http://127.0.0.1:5000/api2/collections/91a7b528-80eb-42ed-a74d-c6fbd5a26116', user='admin', password='Password0')
print(collection.get_object('indicator--252c7c11-daf2-42bd-843b-be65edca9f61'))

# For normal (no pagination) requests
print(collection.get_objects())
print(collection.get_manifest())

# For pagination requests.
# Use *args for other arguments to the call and **kwargs to pass filter information
for envelope in as_pages(collection.get_objects, per_request=50):
	print(envelope)

for manifest_resource in as_pages(collection.get_manifest, per_request=50):
	print(manifest_resource)


return render(request, 'home.htm')

`

TAXII Server : Medallion : server

TAXII Client : Client

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions