cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
263
Views
1
Helpful
1
Replies
allenvose
Beginner

Generate LSP via API (WAE v6.4.8)

I'm having difficulty generating an LSP via API against WAE v6.4.8 controller.  The python script entitled generate-pcep-lsp.py is as follows:

import json

import requests

from requests.auth import HTTPBasicAuth

url = ('http://x.x.x.x:7777/wae/network/modeled/entries/tunnel/pcep/new/create-basic')

headers = ('Content-type: application/json')

content = open('lsp.cfg', 'rb').read()

config = requests.post(url, auth=HTTPBasicAuth('username', 'password'), headers=headers, data=content)

print config.text

=====================================

The lsp.cfg file has contents as follows:

{

   "teTunnel":{

       "name":"tunnel-te204",

       "source":"rtr1",

       "destination":"rtr4"

    }

}   

When executing the script, I get an error that states the following:

AttributeError: 'set' object has no attribute 'items'

Can someone provide insight as to why the above python script and associated json file are producing errors?

1 REPLY 1
allenvose
Beginner

Issue was resolved!

The problem was the way that the headers were defined.  The correction was:

headers = {'Content-type': 'application/json'. 'Accept': 'application/json'}

All other aspects of the python script configuration were correct.

Content for Community-Ad

This widget could not be displayed.