ModuleNotFoundError: No module named 'requests'

Guilherme Freitas 1 Reputation point
2021-01-13T11:12:06.47+00:00

I'm getting the error message below, could you help me?

2021-01-12T19:35:34.885595589Z [2021-01-12 19:35:34 +0000] [42] [INFO] Booting worker with pid: 42
2021-01-12T19:35:35.639190196Z [2021-01-12 19:35:35 +0000] [42] [ERROR] Exception in worker process
2021-01-12T19:35:35.639238597Z Traceback (most recent call last):
2021-01-12T19:35:35.639244397Z File "/opt/python/3.8.6/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-01-12T19:35:35.639258397Z worker.init_process()
2021-01-12T19:35:35.639262698Z File "/opt/python/3.8.6/lib/python3.8/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-01-12T19:35:35.639266698Z self.load_wsgi()
2021-01-12T19:35:35.639270298Z File "/opt/python/3.8.6/lib/python3.8/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-01-12T19:35:35.639274198Z self.wsgi = self.app.wsgi()
2021-01-12T19:35:35.639277898Z File "/opt/python/3.8.6/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-01-12T19:35:35.639281798Z self.callable = self.load()
2021-01-12T19:35:35.639285398Z File "/opt/python/3.8.6/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-01-12T19:35:35.639297098Z return self.load_wsgiapp()
2021-01-12T19:35:35.639300999Z File "/opt/python/3.8.6/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-01-12T19:35:35.639304899Z return util.import_app(self.app_uri)
2021-01-12T19:35:35.639309199Z File "/opt/python/3.8.6/lib/python3.8/site-packages/gunicorn/util.py", line 358, in import_app
2021-01-12T19:35:35.639312999Z mod = importlib.import_module(module)
2021-01-12T19:35:35.639316799Z File "/opt/python/3.8.6/lib/python3.8/importlib/init.py", line 127, in import_module
2021-01-12T19:35:35.639320599Z return _bootstrap._gcd_import(name[level:], package, level)
2021-01-12T19:35:35.639324399Z File "", line 1014, in _gcd_import
2021-01-12T19:35:35.639328499Z File "", line 991, in _find_and_load
2021-01-12T19:35:35.639332399Z File "", line 975, in _find_and_load_unlocked
2021-01-12T19:35:35.639336199Z File "", line 671, in _load_unlocked
2021-01-12T19:35:35.639340000Z File "", line 783, in exec_module
2021-01-12T19:35:35.639343900Z File "", line 219, in _call_with_frames_removed
2021-01-12T19:35:35.639347800Z File "/home/site/wwwroot/app.py", line 4, in
2021-01-12T19:35:35.639351700Z from resources.login import login
2021-01-12T19:35:35.639355400Z File "/home/site/wwwroot/resources/login.py", line 2, in
2021-01-12T19:35:35.639359300Z import requests
2021-01-12T19:35:35.639362900Z ModuleNotFoundError: No module named 'requests'
2021-01-12T19:35:35.654834603Z [2021-01-12 19:35:35 +0000] [42] [INFO] Worker exiting (pid: 42)
2021-01-12T19:35:35.746736394Z [2021-01-12 19:35:35 +0000] [40] [INFO] Shutting down: Master
2021-01-12T19:35:35.747413411Z [2021-01-12 19:35:35 +0000] [40] [INFO] Reason: Worker failed to boot.

2021-01-12T19:38:35.002164796Z
2021-01-12T19:38:35.002190396Z _____
2021-01-12T19:38:35.002195196Z / _ \ __________ _________ ____
2021-01-12T19:38:35.002198296Z / /_\ ___ / | _ __ _/ __ \
2021-01-12T19:38:35.002201496Z / | / /| | /| | /\ /
2021-01-12T19:38:35.002213896Z _
|__ /_____ ____/ || _ >
2021-01-12T19:38:35.002218096Z / / /
2021-01-12T19:38:35.002221196Z
2021-01-12T19:38:35.002224096Z A P P S E R V I C E O N L I N U X
2021-01-12T19:38:35.002226996Z
2021-01-12T19:38:35.002229796Z Documentation: http://aka.ms/webapp-linux
2021-01-12T19:38:35.002232696Z Python 3.8.6
2021-01-12T19:38:35.002235696Z Note: Any data outside '/home' is not persisted
2021-01-12T19:38:35.443827517Z Starting OpenBSD Secure Shell server: sshd.
2021-01-12T19:38:35.919351849Z App Command Line not configured, will attempt auto-detect
2021-01-12T19:38:35.920710841Z Launching oryx with: create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -virtualEnvName antenv -defaultApp /opt/defaultsite
2021-01-12T19:38:35.989197057Z Found build manifest file at '/home/site/wwwroot/oryx-manifest.toml'. Deserializing it...
2021-01-12T19:38:35.997227311Z Build Operation ID: |kSDq2Wd/l6U=.f9566fa0_
2021-01-12T19:38:35.998510704Z Oryx Version: 0.2.20201112.1, Commit: a120bb248aa8d208ca5e02d7d9d075196e79cffd, ReleaseTagName: 20201112.1
2021-01-12T19:38:36.707052532Z Detected an app based on Flask
2021-01-12T19:38:36.714816388Z Generating gunicorn command for 'app:app'
2021-01-12T19:38:36.888239216Z Writing output script to '/opt/startup/startup.sh'
2021-01-12T19:38:37.176025804Z Found virtual environment .tar.gz archive.
2021-01-12T19:38:37.181007176Z Removing existing virtual environment directory /antenv...
2021-01-12T19:38:37.201055664Z Extracting to directory /antenv...
2021-01-12T19:38:38.545567544Z Using packages from virtual environment antenv located at /antenv.
2021-01-12T19:38:38.546301038Z Updated PYTHONPATH to ':/antenv/lib/python3.8/site-packages'
2021-01-12T19:38:39.207923034Z [2021-01-12 19:38:39 +0000] [40] [INFO] Starting gunicorn 20.0.4
2021-01-12T19:38:39.215483963Z [2021-01-12 19:38:39 +0000] [40] [INFO] Listening at: http://0.0.0.0:8000 (40)
2021-01-12T19:38:39.216344355Z [2021-01-12 19:38:39 +0000] [40] [INFO] Using worker: sync
2021-01-12T19:38:39.226827057Z [2021-01-12 19:38:39 +0000] [42] [INFO] Booting worker with pid: 42
2021-01-12T19:38:39.889671945Z 172.16.0.1 - - [12/Jan/2021:19:38:39 +0000] "GET /robots933456.txt HTTP/1.1" 404 232 "-" "HealthCheck/1.0"
2021-01-12T19:38:39.903018120Z 172.16.0.1 - - [12/Jan/2021:19:38:39 +0000] "GET / HTTP/1.1" 404 232 "-" "ms-rest-js/2.1.0 Node/v12.14.1 OS/(x64-Windows_NT-10.0.19041) vscode-azureappservice/0.20.0"

2021-01-12T19:38:45.600628140Z 172.16.0.1 - - [12/Jan/2021:19:38:45 +0000] "GET / HTTP/1.1" 404 232 "-" "ms-rest-js/2.1.0 Node/v12.14.1 OS/(x64-Windows_NT-10.0.19041) vscode-azureappservice/0.20.0"

2021-01-12T19:38:51.321117102Z 172.16.0.1 - - [12/Jan/2021:19:38:51 +0000] "GET / HTTP/1.1" 404 232 "-" "ms-rest-js/2.1.0 Node/v12.14.1 OS/(x64-Windows_NT-10.0.19041) vscode-azureappservice/0.20.0"

2021-01-12T19:38:57.020978424Z 172.16.0.1 - - [12/Jan/2021:19:38:57 +0000] "GET / HTTP/1.1" 404 232 "-" "ms-rest-js/2.1.0 Node/v12.14.1 OS/(x64-Windows_NT-10.0.19041) vscode-azureappservice/0.20.0"

2021-01-12T19:39:02.720124500Z 172.16.0.1 - - [12/Jan/2021:19:39:02 +0000] "GET / HTTP/1.1" 404 232 "-" "ms-rest-js/2.1.0 Node/v12.14.1 OS/(x64-Windows_NT-10.0.19041) vscode-azureappservice/0.20.0"

2021-01-12T19:39:08.469886769Z 172.16.0.1 - - [12/Jan/2021:19:39:08 +0000] "GET / HTTP/1.1" 404 232 "-" "ms-rest-js/2.1.0 Node/v12.14.1 OS/(x64-Windows_NT-10.0.19041) vscode-azureappservice/0.20.0"

2021-01-12T19:39:14.171823265Z 172.16.0.1 - - [12/Jan/2021:19:39:14 +0000] "GET / HTTP/1.1" 404 232 "-" "ms-rest-js/2.1.0 Node/v12.14.1 OS/(x64-Windows_NT-10.0.19041) vscode-azureappservice/0.20.0"

2021-01-12T19:39:19.872519169Z 172.16.0.1 - - [12/Jan/2021:19:39:19 +0000] "GET / HTTP/1.1" 404 232 "-" "ms-rest-js/2.1.0 Node/v12.14.1 OS/(x64-Windows_NT-10.0.19041) vscode-azureappservice/0.20.0"

2021-01-12T19:39:25.556582047Z 172.16.0.1 - - [12/Jan/2021:19:39:25 +0000] "GET / HTTP/1.1" 404 232 "-" "ms-rest-js/2.1.0 Node/v12.14.1 OS/(x64-Windows_NT-10.0.19041) vscode-azureappservice/0.20.0"

2021-01-12T19:39:31.251747800Z 172.16.0.1 - - [12/Jan/2021:19:39:31 +0000] "GET / HTTP/1.1" 404 232 "-" "ms-rest-js/2.1.0 Node/v12.14.1 OS/(x64-Windows_NT-10.0.19041) vscode-azureappservice/0.20.0"

2021-01-12T19:40:01.130023514Z 172.16.0.1 - - [12/Jan/2021:19:40:01 +0000] "GET / HTTP/1.1" 404 232 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 Edg/87.0.664.75"
2021-01-12T19:40:01.376935755Z 172.16.0.1 - - [12/Jan/2021:19:40:01 +0000] "GET /favicon.ico HTTP/1.1" 404 232 "https://apideheus.azurewebsites.net/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 Edg/87.0.664.75"

2021-01-12T19:40:08.688040638Z 172.16.0.1 - - [12/Jan/2021:19:40:08 +0000] "GET / HTTP/1.1" 404 232 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 Edg/87.0.664.75"

2021-01-12T19:40:21.457630510Z 172.16.0.1 - - [12/Jan/2021:19:40:21 +0000] "GET / HTTP/1.1" 404 232 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 Edg/87.0.664.75"

2021-01-12T19:40:43.691309830Z 172.16.0.1 - - [12/Jan/2021:19:40:43 +0000] "GET /login HTTP/1.1" 200 5 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 Edg/87.0.664.75"

2021-01-12T19:47:59.758997084Z 172.16.0.1 - - [12/Jan/2021:19:47:59 +0000] "GET /login HTTP/1.1" 200 5 "-" "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36 Browse/1.48.0"

2021-01-12T19:48:05.447370201Z 172.16.0.1 - - [12/Jan/2021:19:48:05 +0000] "GET /favicon.ico HTTP/1.1" 404 232 "https://apideheus.azurewebsites.net/login" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36"

2021-01-12T19:53:08.208419180Z 172.16.0.1 - - [12/Jan/2021:19:53:08 +0000] "GET /login HTTP/1.1" 200 5 "-" "PostmanRuntime/7.26.8"

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,038 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Guilherme Freitas 1 Reputation point
    2021-01-13T12:32:40.08+00:00

    Yes. I created a python service application.

    Connecting to log stream...
    2021-01-13T12:27:40 Welcome, you are now connected to log-streaming service.

    Starting Log Tail -n 10 of existing logs ----

    /home/LogFiles/__lastCheckTime.txt (https://apidevdeheus.scm.azurewebsites.net/api/vfs/LogFiles/\_\_lastCheckTime.txt)
    01/13/2021 12:26:39

    /home/LogFiles/kudu/trace/619de34c3c90-3e6358b5-4eb2-4c01-81a9-f333e1ec7563.txt (https://apidevdeheus.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace/619de34c3c90-3e6358b5-4eb2-4c01-81a9-f333e1ec7563.txt)
    2021-01-13T12:16:07 Startup Request, url: /api/zipdeploy?isAsync=true&author=VS%20Code, method: POST, type: request, pid: 178,1,5, ScmType: None

    /home/LogFiles/kudu/trace/b152ada318c8-0cfa98a4-3907-4190-985e-5ababcfdc3c3.txt (https://apidevdeheus.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace/b152ada318c8-0cfa98a4-3907-4190-985e-5ababcfdc3c3.txt)
    2021-01-13T12:25:37 Startup Request, url: /api/zipdeploy?isAsync=true&author=VS%20Code, method: POST, type: request, pid: 139,1,4, ScmType: None

    /home/LogFiles/kudu/trace/b152ada318c8-a53ab6b2-8c16-4001-8a90-0d0035d5bdb3.txt (https://apidevdeheus.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace/b152ada318c8-a53ab6b2-8c16-4001-8a90-0d0035d5bdb3.txt)
    at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
    at Kudu.Services.Web.Tracing.TraceMiddleware.Invoke(HttpContext context) in /tmp/KuduLite/Kudu.Services.Web/Tracing/TraceMiddleware.cs:line 55
    2021-01-13T12:26:55 Outgoing response, type: response, statusCode: 500, statusText: InternalServerError

    /home/LogFiles/2021_01_13_lw0sdlwk000307_default_docker.log (https://apidevdeheus.scm.azurewebsites.net/api/vfs/LogFiles/2021_01_13_lw0sdlwk000307_default_docker.log)
    2021-01-13T12:26:52.122424011Z File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
    2021-01-13T12:26:52.122428111Z File "/tmp/8d8b7be59131faf/app.py", line 4, in <module>
    2021-01-13T12:26:52.122432311Z from resources.login import login
    2021-01-13T12:26:52.122436111Z File "/tmp/8d8b7be59131faf/resources/login.py", line 2, in <module>
    2021-01-13T12:26:52.122440411Z import Requests
    2021-01-13T12:26:52.122444211Z ModuleNotFoundError: No module named 'Requests'
    2021-01-13T12:26:52.146770052Z [2021-01-13 12:26:52 +0000] [40] [INFO] Worker exiting (pid: 40)
    2021-01-13T12:26:52.259319238Z [2021-01-13 12:26:52 +0000] [37] [INFO] Shutting down: Master
    2021-01-13T12:26:52.259915039Z [2021-01-13 12:26:52 +0000] [37] [INFO] Reason: Worker failed to boot.

    /home/LogFiles/2021_01_13_lw0sdlwk000307_docker.log (https://apidevdeheus.scm.azurewebsites.net/api/vfs/LogFiles/2021_01_13_lw0sdlwk000307_docker.log)
    2021-01-13T12:22:51.236Z ERROR - Container apidevdeheus_0_01a16080 for site apidevdeheus has exited, failing site start
    2021-01-13T12:22:51.243Z ERROR - Container apidevdeheus_0_01a16080 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
    2021-01-13T12:22:51.245Z INFO - Stopping site apidevdeheus because it failed during startup.
    2021-01-13T12:26:39.844Z INFO - Starting container for site
    2021-01-13T12:26:39.847Z INFO - docker run -d -p 4261:8000 --name apidevdeheus_0_801ae517 -e WEBSITE_SITE_NAME=APIDEVDEHEUS -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=apidevdeheus.azurewebsites.net -e WEBSITE_INSTANCE_ID=43631460bf86d7f40d5b93bbd6d2c1c23daa6bc69ba1ff6fc850102219312bc3 -e HTTP_LOGGING_ENABLED=1 appsvc/python:3.7_20201112.3

    2021-01-13T12:26:44.872Z INFO - Initiating warmup request to container apidevdeheus_0_801ae517 for site apidevdeheus
    2021-01-13T12:26:54.498Z ERROR - Container apidevdeheus_0_801ae517 for site apidevdeheus has exited, failing site start
    2021-01-13T12:26:54.517Z ERROR - Container apidevdeheus_0_801ae517 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
    2021-01-13T12:26:54.584Z INFO - Stopping site apidevdeheus because it failed during startup.

    /home/LogFiles/webssh/pm2.log (https://apidevdeheus.scm.azurewebsites.net/api/vfs/LogFiles/webssh/pm2.log)

    Ending Log Tail of existing logs ---

    Starting Live Log Stream ---

    2021-01-13T12:17:45.663Z INFO - Starting container for site
    2021-01-13T12:17:45.663Z INFO - docker run -d -p 1289:8000 --name apidevdeheus_0_0eaa3604 -e WEBSITE_SITE_NAME=APIDEVDEHEUS -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=apidevdeheus.azurewebsites.net -e WEBSITE_INSTANCE_ID=43631460bf86d7f40d5b93bbd6d2c1c23daa6bc69ba1ff6fc850102219312bc3 -e HTTP_LOGGING_ENABLED=1 appsvc/python:3.7_20201112.3

    2021-01-13T12:17:53.138Z INFO - Initiating warmup request to container apidevdeheus_0_0eaa3604 for site apidevdeheus
    2021-01-13T12:18:09.304Z ERROR - Container apidevdeheus_0_0eaa3604 for site apidevdeheus has exited, failing site start
    2021-01-13T12:18:09.315Z ERROR - Container apidevdeheus_0_0eaa3604 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
    2021-01-13T12:18:09.430Z INFO - Stopping site apidevdeheus because it failed during startup.
    2021-01-13T12:18:43.683Z INFO - Starting container for site
    2021-01-13T12:18:43.684Z INFO - docker run -d -p 2042:8000 --name apidevdeheus_0_a93bbe2c -e WEBSITE_SITE_NAME=APIDEVDEHEUS -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=apidevdeheus.azurewebsites.net -e WEBSITE_INSTANCE_ID=43631460bf86d7f40d5b93bbd6d2c1c23daa6bc69ba1ff6fc850102219312bc3 -e HTTP_LOGGING_ENABLED=1 appsvc/python:3.7_20201112.3

    2021-01-13T12:18:47.874Z INFO - Initiating warmup request to container apidevdeheus_0_a93bbe2c for site apidevdeheus
    2021-01-13T12:18:55.667Z ERROR - Container apidevdeheus_0_a93bbe2c for site apidevdeheus has exited, failing site start
    2021-01-13T12:18:55.686Z ERROR - Container apidevdeheus_0_a93bbe2c didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
    2021-01-13T12:18:55.696Z INFO - Stopping site apidevdeheus because it failed during startup.
    2021-01-13T12:18:56.215Z INFO - Starting container for site
    2021-01-13T12:18:56.217Z INFO - docker run -d -p 3004:8000 --name apidevdeheus_0_7e241d2b -e WEBSITE_SITE_NAME=APIDEVDEHEUS -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=apidevdeheus.azurewebsites.net -e WEBSITE_INSTANCE_ID=43631460bf86d7f40d5b93bbd6d2c1c23daa6bc69ba1ff6fc850102219312bc3 -e HTTP_LOGGING_ENABLED=1 appsvc/python:3.7_20201112.3

    2021-01-13T12:18:59.851Z INFO - Initiating warmup request to container apidevdeheus_0_7e241d2b for site apidevdeheus
    2021-01-13T12:19:07.196Z ERROR - Container apidevdeheus_0_7e241d2b for site apidevdeheus has exited, failing site start
    2021-01-13T12:19:07.218Z ERROR - Container apidevdeheus_0_7e241d2b didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
    2021-01-13T12:19:07.229Z INFO - Stopping site apidevdeheus because it failed during startup.
    2021-01-13T12:19:11.174Z INFO - Starting container for site
    2021-01-13T12:19:11.175Z INFO - docker run -d -p 7941:8000 --name apidevdeheus_0_4a46b74c -e WEBSITE_SITE_NAME=APIDEVDEHEUS -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=apidevdeheus.azurewebsites.net -e WEBSITE_INSTANCE_ID=43631460bf86d7f40d5b93bbd6d2c1c23daa6bc69ba1ff6fc850102219312bc3 -e HTTP_LOGGING_ENABLED=1 appsvc/python:3.7_20201112.3

    2021-01-13T12:19:14.875Z INFO - Initiating warmup request to container apidevdeheus_0_4a46b74c for site apidevdeheus
    2021-01-13T12:19:22.137Z ERROR - Container apidevdeheus_0_4a46b74c for site apidevdeheus has exited, failing site start
    2021-01-13T12:19:22.145Z ERROR - Container apidevdeheus_0_4a46b74c didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
    2021-01-13T12:19:22.160Z INFO - Stopping site apidevdeheus because it failed during startup.
    2021-01-13T12:22:39.579Z INFO - Starting container for site
    2021-01-13T12:22:39.580Z INFO - docker run -d -p 5705:8000 --name apidevdeheus_0_01a16080 -e WEBSITE_SITE_NAME=APIDEVDEHEUS -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=apidevdeheus.azurewebsites.net -e WEBSITE_INSTANCE_ID=43631460bf86d7f40d5b93bbd6d2c1c23daa6bc69ba1ff6fc850102219312bc3 -e HTTP_LOGGING_ENABLED=1 appsvc/python:3.7_20201112.3

    2021-01-13T12:22:43.354Z INFO - Initiating warmup request to container apidevdeheus_0_01a16080 for site apidevdeheus
    2021-01-13T12:22:51.236Z ERROR - Container apidevdeheus_0_01a16080 for site apidevdeheus has exited, failing site start
    2021-01-13T12:22:51.243Z ERROR - Container apidevdeheus_0_01a16080 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
    2021-01-13T12:22:51.245Z INFO - Stopping site apidevdeheus because it failed during startup.

    that's ocodigo app.py

    from flask import Flask
    from flask_restful import Api
    from resources.login import login
    
    app = Flask(__name__)
    api = Api(app)
    
    api.add_resource(login, '/login')
    
    if __name__ =='__main__':
      app.run(debug=True)
    

    that's ocodigo login.py

    from flask_restful import Resource, Api
    import Requests
    import json
    import base64
    import getpass
    
    class login(Resource):
      def get(self):
    
        url = "https://login.microsoftonline.com/{tenant}/oauth2/token"
    
        payload='client_id= &client_secret= &grant_type=client_credentials&resource=https%3A%2F%2F.sandbox.ax.dynamics.com'
        headers = {
          'Content-Type': 'application/x-www-form-urlencoded',
          'Cookie': 'fpc={token}; x-ms-gateway-slice=estsfd; stsservicecookie=estsfd'
        }
    
        response = Requests.request("POST", url, headers=headers, data=payload)
        t = json.loads(response.text)
        token = t['access_token']
        arquivo(token)
    
    def arquivo(token):
    
        url = "https://dhnamics- .sandbox.ax.dynamics.com/api/services/CeServiceGroup_PTR/CeServices_PTR/getBoletoBinary"
    
        payload="{\r\n    \"dataArea\": \"\",\r\n    \"recId\": ,\r\n    \"tableId\": \r\n}"
        headers = {
          'Authorization': 'Bearer '+token,
          'Content-Type': 'application/json'
        }
    
        response = Requests.request("POST", url, headers=headers, data=payload)
        arquivo = json.loads(response.text)
        Abase = arquivo['parmResult']
        usuario = getpass.getuser()
        pdf = base64.b64decode(Abase)
        pdf2 = open("C:\\Users\\" +usuario+"\\Downloads\\boleto.pdf", 'wb')
        pdf2.write(pdf)
    

  2. Jason Freeberg 166 Reputation points
    2021-02-18T21:24:53.683+00:00

    Hi @Guilherme Freitas -- I noticed in the startup logs the container found a virtual environment and tried to start it. Are you deploying a virtual env with your code? Virtual environments aren't portable, so that could be why the request module is not found. Also, where are you deploying from? (GitHub Actions, your local machine, etc)

    2021-01-12T19:38:37.176025804Z Found virtual environment .tar.gz archive.  
    2021-01-12T19:38:37.181007176Z Removing existing virtual environment directory /antenv...  
    2021-01-12T19:38:37.201055664Z Extracting to directory /antenv...  
    2021-01-12T19:38:38.545567544Z Using packages from virtual environment antenv located at /antenv.  
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.