Skip to content

Instantly share code, notes, and snippets.

@acidjunk
Created April 26, 2017 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acidjunk/662bad6c216811ca6b4eb119a9b34e8d to your computer and use it in GitHub Desktop.
Save acidjunk/662bad6c216811ca6b4eb119a9b34e8d to your computer and use it in GitHub Desktop.
# -*- coding: UTF-8 -*-
import jsonrpclib
import argparse
parser = argparse.ArgumentParser(description='Try to setup a connection to an Odoo server and report about version.')
parser.add_argument('--url', dest='url', required=True, help='The url you would use to connect to the Odoo instance')
parser.add_argument('--user', dest='user', default='admin', help='The Odoo user')
parser.add_argument('--password', dest='password', required=True, help='The Odoo password')
parser.add_argument('--database', dest='database', required=True, help='The Odoo database')
args = parser.parse_args()
# server proxy object
url = "{url}/jsonrpc".format(url=args.url)
server = jsonrpclib.Server(url)
user_id = server.call(service="common", method="login", args=[args.database, args.user, args.password])
print user_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment