Я соединяю свой python, который вместе выполняет веб-сканер и код JavaScript
Однако появляется ошибка: "HTTPSConnectionPool(host='www.twreporter.org', port=443): Max retries exceeded with url: /topics?page=13 (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))"
Я пытался import ssl
в своем коде Python, но как только я это сделал, он получил:
undefined:1
Traceback (most recent call last):
^
SyntaxError: Unexpected token T in JSON at position 0
даже код имеет только:
import json
import ssl
print(json.dumps("1234"))
Как я мог это исправить?
вот часть моего кода JavaScript:
let { PythonShell } = require('python-shell')
let options = {
mode: 'json',
pythonOptions: ['-u'],
scriptPath: './python',
};
PythonShell.run('pythontest.py', options, function (err, results, res) {
if (err) console.log(err);
// results is an array consisting of messages collected during execution
console.log(results);
}
ошибка в javascript:
undefined:1
Traceback (most recent call last):
^
SyntaxError: Unexpected token T in JSON at position 0
at JSON.parse (<anonymous>)
at PythonShell.asJson (D:\【code】\database\Reporter\node_modules\python-shell\index.js:358:21)
at D:\【code】\database\Reporter\node_modules\python-shell\index.js:310:42
at Array.forEach (<anonymous>)
at PythonShell.recieveInternal (D:\【code】\database\Reporter\node_modules\python-shell\index.js:306:15)
at PythonShell.receiveStderr (D:\【code】\database\Reporter\node_modules\python-shell\index.js:290:21)
at Socket.<anonymous> (D:\【code】\database\Reporter\node_modules\python-shell\index.js:108:18)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
ОС: Windows 10
питон: питон 3,7
компилятор: Visual Studio Code
Кстати, код Python может работать один на моем компьютере или в Google Colab.