简体   繁体   中英

How to transfer a text (url) from raspberry pi to my laptop remotely

I have a raspberry pi mounted on my RC drone. It scans a QR code and gets the URL of a website by processing the QR code. I did that part. Now I need to send that url(text) to my laptop and open that on a web browser remotely. I am not allowed to touch the laptop after setting it up once. How can this be done? Using SSH? or I was thinking that I could write that url to notepad.pw/unique and my laptop then opens notepad.pw/unique , gets the url by scraping it, then runs it on webbrowser.

A simple restful server seems to suit for your situation.

The following is implemented by flask

** server.py **

from flask import Flask
app = Flask(__name__)


@app.route('/')
def index():
    fun_dict = {
    'get_QR_code':'/get_qr_content'
}
return jsonify(fun_dict)


@app.route('/get_qr_content')
def get_qr_content():
    return YOUR_QRCODE_CONTENT

if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True)

# python server.py

Now you can get YOUR_QRCODE_CONTENT through curl , python request.get whatever method to access http content.

Or just type in your browser

http://0.0.0.0/get_qr_content

Note: 0.0.0.0 is assume your device and laptop both in the same LAN. If not, you have to setup an ip address let both side is able to ping each other.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM