← Back to Blog

Poc to Prototype for the python functions in Azure

Poc to Prototype for the python functions in Azure Run notion to create it Run it in replit to test Set the server Fix naming issues Practical create in the portal Add the httptrigger Even Azure is ready for the testing Cut the tested function Initila basic run Add parameters and

Poc to Prototype for the python functions in Azure

Run notion to create it

poc to prototype 1

Run it in replit to test

poc to prototype 2

Set the server

poc to prototype 3

Fix naming issues

poc to prototype 4

Practical create in the portal

poc to prototype 5

Add the httptrigger

poc to prototype 6

Even Azure is ready for the testing

poc to prototype 7

Cut the tested function

poc to prototype 8

Initila basic run

poc to prototype 9

Add parameters and run

poc to prototype 10

Use the testing parameters

{

"html_to_text":"Dear candidate, we are looking for a talented software engineer with experience in C#, .NET, and SQL. Please respond if you are interested.",

"my_key_value":["software", "C#", ".NET", "SQL"]

}

Backup Code for the function ( crying baby backup)

`import logging

from azure.functions import HttpRequest, HttpResponse

def process_text_array(html_to_text, my_key_value):
result = [key for key in my_key_value if key in html_to_text]
return result

def main(req: HttpRequest) -> 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 HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
                else:
                    return HttpResponse(
                        "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
                        status_code=200
                    )`
                

see logs

poc to prototype 11

warning sign 3rd party is not supported with linux

Adding third party dependencies in the Azure portal is currently not supported for Linux Consumption Function Apps. Click here to setup local environment.Learn more

documentation

https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=python-v2%2Cisolated-process%2Cnodejs-v4%2Cfunctionsv2&pivots=programming-language-python

find parameter

poc to prototype 12

https://learn.microsoft.com/en-us/python/api/azure-functions/azure.functions.httprequest?view=azure-python

research similar cases

https://github.com/Azure/azure-functions-python-worker/issues/762

update the runner namers

poc to prototype 13

get error from monitor

poc to prototype 14

Logs can be seen

poc to prototype 15

so tactics > test in replit and see the runner nos in azure appinsights

Simplified json testing

poc to prototype 16

test access of the parameters

poc to prototype 17

auto inserted one is different

more structure and more whole

poc to prototype 18

basic for errors> https://github.com/Azure/azure-functions-python-worker/issues/762

debugger needs to be set there

poc to prototype 19

errors not at real time

poc to prototype 20

check json which is valid

poc to prototype 21

none real time debug is an issue

poc to prototype 22

Can i take it inside replit?

poc to prototype 23

it can import

poc to prototype 24

replit feels it is checking the syntax

poc to prototype 25

here

poc to prototype 26

dynamicly coded does not hit the code that does not run

poc to prototype 27

stub line by line ?

poc to prototype 28

open up slowly

poc to prototype 29

found the error at 7

poc to prototype 30

Feels like there is extra paranthesis

poc to prototype 31

too many linting i missed the bottom one

poc to prototype 32

json sub action

poc to prototype 33

test different versions

poc to prototype 34


Imported from rifaterdemsahin.com · 2024