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

adding extra fields to JSON RPC request structure (try 2) #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

adding extra fields to JSON RPC request structure (try 2) #19

wants to merge 1 commit into from

Conversation

beli-sk
Copy link

@beli-sk beli-sk commented Oct 9, 2012

Adding custom fields to JSON RPC request.
For use with servers implementing authentication with 'auth' field containing session ID (Zabbix API for example):

import jsonrpc
server = jsonrpclib.Server('http://www.example.org/zabbix/api_jsonrpc.php')

# call remote login method and read the session ID
sid = server.user.login(user = 'apitest', password = 'atest9')

# set the 'extra' module parameter to contain the session ID
server._set_extra({ 'auth': sid })

# go on with other procedures which require authentication, e.g.
server.hostgroup.get(output = 'extend', sortfield = 'name')

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

Successfully merging this pull request may close these issues.

1 participant