Created
April 26, 2017 12:29
-
-
Save acidjunk/662bad6c216811ca6b4eb119a9b34e8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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