Skip to main content

How to сreate AWS Lambda Layer with Zeep Library

Python Zeep library designed to work with SOAP - services. Zeep is a pure-python module. However the lxml dependency does contain C code since it uses libxml2 and libxslt.

So the Zeep library can not be deployed into the Lambda Layer without some tricks. In one of my Serverless projects, I needed to use this library, and I found such a way to deploy it into the Layer:
First, as usual, create a directory:
mkdir -p python/lib/python3.6/site-packages/
Install Zeep via pip there:
pip install zeep --target python/lib/python3.6/site-packages/
The library with the dependencies will be installed in this directory. Go there and delete the lxml library folders:
Paste in the folder this version of the lxml library: https://github.com/BedrosovaYulia/aws-lambda-lxml/tree/master/3.8.0/py36/lxml (this version does not use libxml2 and libxslt) Now we can pack the pyton folder in a zip archive, upload it to Lambda Layer and work with SOAP. For example, we can get information about post tracking number from the Russian Post service: It works!

Comments

  1. i really appreciate this work. I was looking for this solution a couple of hours. Thank you so much

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. Im thankful for the blog post.Really looking forward to read more. Will read on
    aws online training
    r programming online training

    ReplyDelete

Post a Comment

Popular posts from this blog

How to add a custom activity type in Bitrix24 CRM

During one of our recent self-hosted Bitrix24 implementations, we had the task of adding a new type of Activity to CRM - something between a Call Activity and a Visit Activity. The customer wanted this new Activity to be able to participate in CRM reports and filters. To begin with, it was necessary to add a link to a new Activity type in the CRM entity card. We found out that the crm.timeline component is responsible for the output of this part of the interface. In particular, its template.php contains a list of displayed links to case types. For example, for a call, something like: Accordingly, as we can see, this is a regular link with the data parameter item-item-id. So we can add ours, with our own unique data-item-id. As you can see, the href for the link is set as "#" - clicking on this link is processed by the JS code from the script.js of this component. Indeed, the BX.CrmTimelineMenuBar function is responsible for this.processItemSelection().

How to setup server for Bitrix24 on AWS EC2