У меня есть такой код, который работает локально и выдает ошибку на сервере Линукс:
from zeep import Client
from zeep.transports import Transport
from requests import Session
from requests.auth import HTTPBasicAuth
import xmltodict
from html.parser import HTMLParser
import json
class EtranClient:
def __init__(self, user='username', password='pass'):
self.user = user.encode('utf-8')
self.password = password.encode('utf-8')
session = Session()
session.auth = HTTPBasicAuth(self.user, self.password)
transport = Transport(session = session)
self.client = Client('etran.wsdl', transport=transport)
def mk_request(self, req):
with self.client.options(raw_response = True):
response = self.client.service.GetBlock(self.user,
self.password,
req)
return response.content
Ошибка такая:
Traceback (most recent call last): File "invoice_handler.py", line 76, in <module> get_invoices(conn) File "invoice_handler.py", line 61, in get_invoices invoice_ids = invoice.get_invoice_id_list_by_date(last_request_date) File "/home/user/etran-client/invoice.py", line 52, in get_invoice_id_list_by_date response = client.xml_request(request) File "/home/user/etran-client/client.py", line 33, in xml_request text = self.request_text_as_dict(req) File "/home/user/etran-client/client.py", line 27, in request_text_as_dict xml_response = self.mk_request(req) File "/home/user/etran-client/client.py", line 20, in mk_request with self.client.options(raw_response = True): AttributeError: 'Client' object has no attribute 'options'
Локально свойство options устанавливается без ошибки. Проблема возникает только на сервере. Что может быть не так?