skip to Main Content
import azure.durable_functions as df
bp_chat = df.BluePrint()

Exception: AttributeError: module ‘azure.durable_functions’ has no attribute ‘BluePrint’

Now the latest version of azure.durable_functions is 1.2.6, I tried with it and 1.2.3 too. But neither of them works.

I use BluePrint to use my code in an other python file, it is not working without it

I want to run my function_app.py, without errors

2

Answers


  1. Chosen as BEST ANSWER

    I tryed with 1.2.0 and it is sure that it does not contains the BluePrint.

    But in the 1.2.3 version I found this class in this path azure.durable_functions.decorators.durable_app.BluePrint()

    I realized that pip is not updated the module properly. I deleted the pip env and I tried again with

    pip install azure-functions-durable==1.2.3
    

  2. Refer my SO thread answer to work with blueprint in Azure Functions.

    Blueprint method is not part of azure.durable_functions in order for blueprint to work, Create 2 files as per this MS Document

    My function_app.py:-

    import azure.functions as func 
    from sidblueprint import bp
    
    app = func.FunctionApp() 
    
    app.register_functions(bp)
    

    My blueprint.py which is calling the blueprint object from function_app.py:-

    import logging 
    
    import azure.functions as func 
    
    bp = func.Blueprint() 
    
    @bp.route(route="default_template") 
    def default_template(req: func.HttpRequest) -> func.HttpResponse: 
        logging.info('Python HTTP trigger function processed a request.') 
    
        name = req.params.get('name') 
        if not name: 
            try: 
                req_body = req.get_json() 
            except ValueError: 
                pass 
            else: 
                name = req_body.get('name') 
    
        if name: 
            return func.HttpResponse( 
                f"Hello, {name}. This HTTP-triggered function " 
                f"executed successfully.") 
        else: 
            return func.HttpResponse( 
                "This HTTP-triggered function executed successfully. " 
                "Pass a name in query or body" 
                " personalized response.", 
                status_code=200 
            )
    

    Output:-

    enter image description here

    enter image description here

    If you want to use blueprint pip module, Directly install it by referring here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search