@vercel/python 3.1.24 → 3.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vc_init.py +7 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/python",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.25",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"execa": "^1.0.0",
|
|
28
28
|
"typescript": "4.3.4"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "8d2c0fec89b34c98e0a6123516d54407fc1cb738"
|
|
31
31
|
}
|
package/vc_init.py
CHANGED
|
@@ -4,6 +4,7 @@ import json
|
|
|
4
4
|
import inspect
|
|
5
5
|
from importlib import util
|
|
6
6
|
from http.server import BaseHTTPRequestHandler
|
|
7
|
+
import socket
|
|
7
8
|
|
|
8
9
|
# Import relative path https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
|
|
9
10
|
__vc_spec = util.spec_from_file_location("__VC_HANDLER_MODULE_NAME", "./__VC_HANDLER_ENTRYPOINT")
|
|
@@ -37,7 +38,7 @@ if 'handler' in __vc_variables or 'Handler' in __vc_variables:
|
|
|
37
38
|
import http
|
|
38
39
|
import _thread
|
|
39
40
|
|
|
40
|
-
server = HTTPServer(('', 0), base)
|
|
41
|
+
server = HTTPServer(('127.0.0.1', 0), base)
|
|
41
42
|
port = server.server_address[1]
|
|
42
43
|
|
|
43
44
|
def vc_handler(event, context):
|
|
@@ -57,8 +58,11 @@ if 'handler' in __vc_variables or 'Handler' in __vc_variables:
|
|
|
57
58
|
body = base64.b64decode(body)
|
|
58
59
|
|
|
59
60
|
request_body = body.encode('utf-8') if isinstance(body, str) else body
|
|
60
|
-
conn = http.client.HTTPConnection('
|
|
61
|
-
|
|
61
|
+
conn = http.client.HTTPConnection('127.0.0.1', port)
|
|
62
|
+
try:
|
|
63
|
+
conn.request(method, path, headers=headers, body=request_body)
|
|
64
|
+
except (http.client.HTTPException, socket.error) as ex:
|
|
65
|
+
print ("Request Error: %s" % ex)
|
|
62
66
|
res = conn.getresponse()
|
|
63
67
|
|
|
64
68
|
return_dict = {
|