Azure function - jak za pomocą curl zrobić request?

Azure function - jak za pomocą curl zrobić request?
EE
  • Rejestracja:około 6 lat
  • Ostatnio:ponad 4 lata
  • Postów:36
0

Cześć,
Jestem kompletnie zielony w tej tematyce..
https://docs.microsoft.com/en-us/azure/developer/python/tutorial-vs-code-serverless-python-06
Mam:

Kopiuj
Http Functions:
         DigitsOfPi: [GET] http://localhost:7071/api/DigitsOfPi
         HttpExample: [GET,POST] http://localhost:7071/api/HttpExample

Utknąłem na punkcie:
In a browser, or from curl, make a request to http://localhost:7071/api/DigitsOfPi?digits=125 and observe the output. (You might notice that the code's algorithm isn't entirely accurate, but we'll leave the improvements to you!) Stop the debugger when you're finished.

Kopiuj
PS C:\Users\PanKomputer\Lingaro\HttpExample> curl http://localhost:7071/api/DigitsOfPi -d digits=12345
edytowany 1x, ostatnio: elo_elo_elo
lion137
  • Rejestracja:około 8 lat
  • Ostatnio:26 minut
  • Postów:4935
0

I co jaki jest wynik?


EE
  • Rejestracja:około 6 lat
  • Ostatnio:ponad 4 lata
  • Postów:36
0

@lion137:

Kopiuj
PS C:\Users\PanKomputer\Lingaro\HttpExample> curl --header "Content-Type: application/json" --request POST --data {"""name""":"""Visual Studio Code"""} http://localhost:7071/api/HttpExample
At line:1 char:81
+ ... n" --request POST --data {"""name""":"""Visual Studio Code"""} http:/ ...
+                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token ':"""Visual Studio Code"""' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

Ale juz znalazlem inny sposob, po prostu przez przegladarke:

Kopiuj
http://localhost:7071/api/DigitsOfPi?digits=125
EE
  • Rejestracja:około 6 lat
  • Ostatnio:ponad 4 lata
  • Postów:36
0

Utknąłem w innym miejscu. A mianowicie w "Add a storage binding for Azure Functions in Python". Problemem jest plik: local.settings.json oraz "AzureWebJobsStorage". Jeżeli uzyje funkcji: Azure Functions: Download Remote Settings i ustawiony zostanie wartość: "AzureWebJobsStorage": taka jak w konfiguracji na portal.azure to requesty kończą się timeoutem.

[2020-12-13T08:41:03.172Z] Starting worker process failed
[2020-12-13T08:41:03.179Z] The operation has timed out.
[2020-12-13T08:42:03.210Z] Starting worker process failed
[2020-12-13T08:42:03.216Z] The operation has timed out.
[2020-12-13T08:42:03.234Z] Exceeded language worker restart retry count for runtime:python. Shutting down and proactively recycling the Functions Host to recover

Zarejestruj się i dołącz do największej społeczności programistów w Polsce.

Otrzymaj wsparcie, dziel się wiedzą i rozwijaj swoje umiejętności z najlepszymi.