Repository navigation
Retail API - Python #128
nandyale-olive
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello ,
I am facing issue while calling the retail API with Python code as well... i am using pfx file for the same.
import os
from contextlib import contextmanager
import tempfile
import random
from OpenSSL import crypto
from requests import Session
from requests_pkcs12 import Pkcs12Adapter
from zeep import Client, Settings
from zeep.transports import Transport
from zeep.wsse.signature import BinarySignature
pfx_path = r"filename.pfx"
session = Session()
session.mount('https://misapi.ercot.com/retailAPI/',Pkcs12Adapter(pkcs12_filename=pfx_path, pkcs12_password='password))
wsdl_path = r"fielname.wsdl"
transport = Transport(session=session)
client = Client(wsdl_path, transport=transport)
def generate_nonce(length=15):
return ''.join([str(random.randint(0, 9)) for _ in range(length)])
request_data = {
"Request": {
}
BInary Security Token
binary_signature = BinarySignature(r"fielname.pem",r"fielname.cer")
client = Client(wsdl_path, settings=Settings(forbid_entities=False),
transport=transport, wsse=binary_signature)
Making Soap Request
try:
result = client.service.GetESIIDByAddr(**request_data)
print("API Response:")
print(result)
except Exception as e:
print(f"Error: {e}")
I get below error:

All reactions