How to deploy a code using Infusionsoft SDK for Python on GCF

Hi,
I’m trying to deploy a simle code that adds manual payment to an invoice with Infusionsoft SDK for Python.
It works fine locally but will fail on deploying.
Any tips to use it for GCF I’m missing?

Here is all the source.

Thank you in advance,

I also did it like this but still not working.

from xmlrpc.client import ServerProxy, Error


class Infusionsoft(object):
    base_uri = 'https://%s.infusionsoft.com/api/xmlrpc'

    def __init__(self, name, api_key, use_datetime=False):
        uri = self.base_uri % name
        self.client = ServerProxy(uri, use_datetime=use_datetime)
        self.client.error = Error
        self.key = api_key

    def __getattr__(self, service):
        def function(method, *args):
            call = getattr(self.client, service + '.' + method)

            try:
                return call(self.key, *args)
            except self.client.error as v:
                return "ERROR", v

        return function

    def server(self):
        return self.client


class InfusionsoftOAuth(Infusionsoft):
    base_uri = 'https://api.infusionsoft.com/crm/xmlrpc/v1?'

    def __init__(self, access_token, use_datetime=False):
        uri = '%saccess_token=%s' % (self.base_uri, access_token)

        self.client = ServerProxy(uri, use_datetime=use_datetime)
        self.client.error = Error
        self.key = access_token

import json, requests, datetime,os


access_token = requests.get("https://****").text
private_code = os.getenv("private_code")

def orderCreation(request):
    request_json = request.get_json()
    
    if request_json["private_code"] != private_code:
        return 'You need Private Code to run this function', 403
    
    else:
        infusionsoft = InfusionsoftOAuth(access_token)
        invID = request_json["InvoiceId"]
        amount = request_json["amount"]
        date = request_json["date"]
        payType = "From Shopify"
        description = request_json["notes"]
        bypassComm = False

        req2 = infusionsoft.InvoiceService("addManualPayment",invID,amount,date,payType,description,bypassComm)
        return req2, 200

Turned out I uesed to dictate “requests” in requirements.txt and only recently that I carefully read this article. Thought “requests” was pre-installed, didn’t have to have it in requirements.txt but this was the cause of the error.
Adding

requests==2.26.0

Solved the issue.