Skip to Content
Menu
This question has been flagged
2 Replies
3009 Views

I am trying to my site using the api. Here is my script

from xmlrpc import client

domain = "url"
user = 'user'
password = "password"
db = 'db'

api = client.ServerProxy("https://%s/xmlrpc/2/object" % domain)
common = client.ServerProxy("https://%s/xmlrpc/2/common" % domain)
uid = common.authenticate(db, user, password, {})


I keep getting this error "ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:992)".

This script works on another pc with the same OS so im not sure what the problem is.


This is the full traceback

Traceback (most recent call last):
File "C:\Users\User\Documents\odoo\Report\\.py",\\ line\\ 162,\\ in\\ main
\\ \\ \\ \\ comp\\ =\\ od\\.session\\(DOMAIN,\\ DB,\\ USER,\\ PASSWORD\\)
\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^
\\ \\ File\\ "C:\Users\User\Documents\odoo\odoodata\odooapi\.py",\ line\ 15,\ in\ __init__
\ \ \ \ self\.uid\ =\ common\.authenticate\(db,\ user,\ password,\ \{\}\)
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^
\ \ File\ "C:\Users\ User \AppData\Local\Programs\Python\Python311\Lib\xmlrpc\client\.py",\ line\ 1122,\ in\ __call__
\ \ \ \ return\ self\.__send\(self\.__name,\ args\)
\ \ \ \ \ \ \ \ \ \ \ \^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^
\ \ File\ "C:\Users\ User \AppData\Local\Programs\Python\Python311\Lib\xmlrpc\client\.py",\ line\ 1464,\ in\ __request
\ \ \ \ response\ =\ self\.__transport\.request\(
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^
\ \ File\ "C:\Users\ User \AppData\Local\Programs\Python\Python311\Lib\xmlrpc\client\.py",\ line\ 1166,\ in\ request
\ \ \ \ return\ self\.single_request\(host,\ handler,\ request_body,\ verbose\)
\ \ \ \ \ \ \ \ \ \ \ \^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^
\ \ File\ "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\xmlrpc\client\.py",\ line\ 1178,\ in\ single_request
\ \ \ \ http_conn\ =\ self\.send_request\(host,\ handler,\ request_body,\ verbose\)
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^
\ \ File\ "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\xmlrpc\client\.py",\ line\ 1291,\ in\ send_request
\ \ \ \ self\.send_content\(connection,\ request_body\)
\ \ File\ "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\xmlrpc\client\.py",\ line\ 1321,\ in\ send_content
\ \ \ \ connection\.endheaders\(request_body\)
\ \ File\ "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\http\client\.py",\ line\ 1277,\ in\ endheaders
\ \ \ \ self\._send_output\(message_body,\ encode_chunked=encode_chunked\)
\ \ File\ "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\http\client\.py",\ line\ 1037,\ in\ _send_output
\ \ \ \ self\.send\(msg\)
\ \ File\ "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\http\client\.py",\ line\ 975,\ in\ send
\ \ \ \ self\.connect\(\)
\ \ File\ "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\http\client\.py",\ line\ 1454,\ in\ connect
\ \ \ \ self\.sock\ =\ self\._context\.wrap_socket\(self\.sock,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^
\ \ File\ "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\ssl\.py",\ line\ 517,\ in\ wrap_socket
\ \ \ \ return\ self\.sslsocket_class\._create\(
\ \ \ \ \ \ \ \ \ \ \ \^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^
\ \ File\ "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\ssl\.py",\ line\ 1075,\ in\ _create
\ \ \ \ self\.do_handshake\(\)
\ \ File\ "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1346, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:992)

Avatar
Discard
Author Best Answer

No change

Avatar
Discard
Best Answer

Hi,

Can you try with below code and see how it goes:

import xmlrpc.client

url = 'url'
db = 'test_db'
username = 'demo'
password = 'demo'

common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
uid = common.authenticate(db, username, password, {})


Official Documentation: https://www.odoo.com/documentation/16.0/developer/api/external_api.html


Thanks  & Regards

Avatar
Discard
Related Posts Replies Views Activity
2
Jan 19
4829
2
Nov 23
16905
0
Jan 18
3900
1
Nov 24
161
1
Jan 24
316