Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Events] Failed to generate an user event #10

Open
claudiuolteanu opened this issue Sep 15, 2014 · 5 comments
Open

[Events] Failed to generate an user event #10

claudiuolteanu opened this issue Sep 15, 2014 · 5 comments

Comments

@claudiuolteanu
Copy link

Hello folks,

When I generate an user event I receive the following error:
"AttributeError: 'dict' object has no attribute 'paramType'" , raised on swaggerpy/client.py line 73. (more details here [1]).

I believe that this is a swagger-py limitation since the parameter type is expected to be 'path' or 'query' and when you generate an user event the type of 'variables' parameter will be 'body' .

Below you can find the code which generates the error:

connection = ari.connect('http://localhost:8088', 'user', 'password') # connect to the ARI server
connection.events.userEvent(eventName="NewEvent", 
                            application='Test', 
                            variables={"variables" : {"var1":"value1"}}) # generate the user event

[1]
error

All the best,
Claudiu

@matt-jordan
Copy link
Contributor

You're correct. Right now, swagger-py does not support body parameters - as such, it doesn't have support for a dictionary of values that should be converted to JSON.

@matt-jordan
Copy link
Contributor

And, this is a problem in swagger-py, not ari-py (it just happens to break ari-py as well).

@litnimax
Copy link

Is swagger-py expected to support body params?
Who is responsible for developing it?
Thanks.

@matt-jordan
Copy link
Contributor

No one is "responsible". It's an open source project, currently under the Digium repo (since that's what we had available at the time).

https://github.com/digium/swagger-py

Anyone can make a pull request to it.

@nhorelik
Copy link

Note that if you really need this functionality, you can still simply make posts manually. For example:

import json
import requests
data = json.dumps({'variables': {'myvar': 'myval'}})
headers = {'Content-type': 'application/json', 'Accept': 'application/json'}
auth = ('username', 'password')
params = {'eventName': 'myevent', 'application': 'myappname'}
requests.post('http://127.0.0.1:8088/ari/events/user/myevent',data=data, headers=headers, auth=auth, params=params)

I'd prefer to use ari-py everywhere though, so hopefully this functionality will be added in the next release! See digium/swagger-py#9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants