Skip to content

Commit cb6d765

Browse files
author
luyishisi
committed
py_LAN && pi_camera
1 parent c11ea72 commit cb6d765

File tree

14 files changed

+4636
-0
lines changed

14 files changed

+4636
-0
lines changed

python_LAN/.server.py.swp

12 KB
Binary file not shown.

python_LAN/1.txt

Lines changed: 4528 additions & 0 deletions
Large diffs are not rendered by default.

python_LAN/HTTP.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import http.service, os
2+
3+
os.chdir("/home/pi")
4+
httpd = http.sercer.HTTPServer(('127.0.0.1', 8000),
5+
http.sercer.SimpleHTTPRequestHandler)
6+
httpd.serve_forever()

python_LAN/flask-test.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#coding:utf-8
2+
from flask import Flask
3+
from flask import request
4+
5+
app = Flask(__name__)
6+
7+
@app.route('/', methods=['GET', 'POST'])
8+
def home():
9+
return '<h1>Home</h1>'
10+
11+
@app.route('/signin', methods=['GET'])
12+
def signin_form():
13+
return '''<form action="/signin" method="post">
14+
<p><input name="username"></p>
15+
<p><input name="password" type="password"></p>
16+
<p><button type="submit">Sign In</button></p>
17+
</form>'''
18+
@app.route('/signin', methods=['POST'])
19+
def signin():
20+
# 需要从request对象读取表单内容:
21+
if request.form['username']=='admin' and request.form['password']=='password':
22+
return '<h3>Hello, admin!</h3>'
23+
return '<h3>Bad username or password.</h3>'
24+
if __name__ == '__main__':
25+
app.run()

python_LAN/hello.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# hello.py
2+
3+
def application(environ, start_response):
4+
start_response('200 OK', [('Content-Type', 'text/html')])
5+
return [b'<h1>Hello, web!</h1>']

python_LAN/hello.pyc

406 Bytes
Binary file not shown.

python_LAN/server.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# coding:utf-8
2+
# 从wsgiref模块导入:
3+
from wsgiref.simple_server import make_server
4+
# 导入我们自己编写的application函数:
5+
from hello import application
6+
7+
# 创建一个服务器,IP地址为空,端口是8000,处理函数是application:
8+
httpd = make_server('', 8000, application)
9+
print('Serving HTTP on port 8000...')
10+
# 开始监听HTTP请求:
11+
httpd.serve_forever()
29.5 KB
Loading

raspi_camera/get-png-test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import subprocess
2+
subprocess.call(["raspistill","-o","test.png"])

raspi_camera/raspistill.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)