Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
8792 Vistas

I'm facing an Odoo SSL error. The error is:

raise SSLError(e, request=request)
SSLError: HTTPSConnectionPool(host='12.123.12.12', port=443): Max retries exceeded with url: /api/logistics/filldetailsntf (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)'),))

I'm writing a controller and I was checking on it. I need to know also how to turn off /Bypass the SSL Certification Verification in this controller. I'm pasting the controller below.

# -*- coding: utf-8 -*-
from odoo import http
import ssl
import requests
import json
from odoo.http import request
import urllib, urllib2
from odoo import report as odoo_report
import datetime
import pytz
import base64
import logging

_logger = logging.getLogger(__name__)

url = 'https://12.123.12.12/api/logistics/filldetailsntf'
authentication = '129487521452XSDFG156235C6B353CD75QWERBVFGHJAA96AA99EDSJUITH7AAF65258F22871E7D415EB4A77CF7B4CB513A993680FC6053EAE6RT785YUIJ124'


class MyApi(http.Controller):

@http.route("/my/post/api/path", url=url, auth="public", type='http', methods=['POST', 'GET'], csrf=False, cors='*',
ssl=False, verify=False)
def post_api_method(self, **kw):
partners = request.env['import.logic'].sudo().search_read([('customer', '=', 'TRADING COMPANY')])
print kw
headers = {'Content-Type': 'application/json'}
body = {'results': {"shipmentType": "partners",
"shipperName": "Name",
"consigneeName": "*****",
"vslexparvlDate": "2019-03-05 05:55:13:000",
"vsldischlDate": "2019-04-02 05:55:13:000",
"docRecvByMailDate": "2019-03-05 05:55:13:000",
"orgDocRecvgDate": "2019-03-24 05:55:13:000",
"vesselArvlDate": "2019-03-19 05:55:13:000",
"bLAwbNumber": "*****",
"houseBL": "****",
"dischargingPort": "*****",
"landingPort": "*****",
"containerNumber": "*****",
"delOrderDate": "2019-03-29 05:55:13:000",
"delOrderNumber": "******",
"bayanNumber": "*****",
"bayanDate": "2019-03-30 05:55:13:000",
"containerType": "*****",
"dutyPaidDate": "2019-03-22 05:55:13:000",
"transportNTFTerminal": "***",
"transportDirCustomer": "***",
"demmurageDate": "2019-03-27 05:55:13:000",
"lastDetentionDate": "2019-03-27 05:55:13:000",
"eIRReturnToShipLine": "****",
"eventUpdateStatus": "Delivered"
}}
response = requests.post(url, json.dumps(body), headers=headers)
return response


This is the code I have written. I need to push the data from my odoo to this API first. While I was testing only I got this error. First I need to solve this ssl error and I need to assign the correct field on each and every key with my field value from inside of the `partner` which is mentioned in the code.

I'm using Odoo.sh, if anybody can please help me.

Avatar
Descartar
Mejor respuesta

it seems targeted API refuse to answer because of too many requests are sent 
ref: https://stackoverflow.com/questions/23013220/max-retries-exceeded-with-url-in-requests

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
7
ene 24
48605
2
oct 20
3489
0
feb 21
3139
0
abr 17
2792
0
jul 21
3258