저는 Flask, Twilio 및 Ngrok를 사용하여 Raspberry Pi에서 프로그램을 실행하고 있습니다. 브라우저에서 ngrok URL에 액세스 할 때 ngrok의 사용자 이름/비밀번호 인증이 제대로 작동하지만 인증을 위해 문자 메시지에 username/pw를 전달하고 코드를 계속 전달하고자합니다.비밀 번호가있는 Twilio와 Ngrok?
심지어 가능합니까?
app = Flask(__name__)
@app.route("/", methods=['GET', 'POST'])
def camera_toggle():
from_number = request.values.get('From', None)
from_message = request.values.get('Body', None)
resp = MessagingResponse()
resp.message("Please enter your username:password")
if ":" not in from_message:
#Split the username/password, then somehow login??
return str(resp)
else:
from_number = request.values.get('From', None)
from_message = request.values.get('Body', None)
if callers[from_number] == "John Doe":
if from_message == "CameraON":
subprocess.call(["bash", "camera.sh"])
return str("Please enter the keyword to turn on the camera")
이 경우에도 가능합니까?
감사합니다. @philnash. 예제 코드를 이해하는 데 어려움을 겪고 있으며 필요한 코드를 구현하는 방법을 잘 모릅니다. SMS를 통해 사용자 이름/암호를 입력하라는 논리를 어떻게 포함 시킬지는 모르겠다. –
아, 사용자 이름과 암호를 묻는 메시지를 표시하려면 ngrok의 HTTP 기본 인증을 사용할 수 없습니다. 응용 프로그램 자체에 인증을 구축해야합니다. – philnash