-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unsupported operand type(s) for +: 'NoneType' and 'str' 해결해야함
- Loading branch information
1 parent
0a6625a
commit fc2812b
Showing
6 changed files
with
76 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
|
||
__pycache__/qrcode.cpython-312.pyc | ||
__pycache__/result.png | ||
__pycache__/studentinfo.cpython-312.pyc | ||
/__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# CNUqrcode | ||
충남대학교 본인인증 QR코드 생성기 | ||
# CNUqrweb | ||
충남대학교 본인인증 QR코드 생성 웹사이트 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from flask import Flask, jsonify | ||
from qr import image | ||
import studentinfo | ||
|
||
app = Flask(__name__) | ||
|
||
@app.route('/') | ||
@app.route('/cnuqr') | ||
def cnuqrhome(): | ||
return '/cnuqr/학번 형식으로 접속해주세요. System Operational.' | ||
|
||
@app.route('/cnuqr/<ID>', methods=['GET']) | ||
def handleCNUqr(ID): | ||
studentinfo.setStudentID(ID) | ||
return image.load("result.png") | ||
|
||
if __name__ == '__main__': | ||
app.run('127.0.0.1', 5000, debug=True) | ||
|
||
# 설정시 다시 작동. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,43 @@ | ||
# 여기에 코드를 입력하세요. | ||
|
||
# 충남대학교 도서관 어플리케이션과 충남대학교 공식 앱에 뜨는 | ||
# 본인 확인용 QR코드 생성 코드입니다. | ||
|
||
# 이미지가 다운로드 되면 성공입니다. | ||
|
||
# 제작자 : 화학과 24 최민서 | ||
|
||
# 필요한 라이브러리를 import합니다. | ||
import base64 | ||
import time, datetime | ||
import qrcode | ||
|
||
# 교번 또는 학번을 입력받습니다. | ||
studentID = str(input("학번 또는 교번을 입력하십시오 : ")) | ||
|
||
now = datetime.datetime.now() | ||
|
||
year = str(now.year) | ||
month = str(now.month) | ||
day = str(now.day) | ||
hour = str(now.hour) | ||
minute = str(now.minute) | ||
second = str(now.second) | ||
|
||
newMonth = month.rjust(2,'0') | ||
newDay = day.rjust(2,'0') | ||
newHour = hour.rjust(2,'0') | ||
newMinute = minute.rjust(2,'0') | ||
newSecond = second.rjust(2,'0') | ||
|
||
timeStamp = str(year + newMonth + newDay + newHour + newMinute + newSecond) | ||
|
||
# 코드 형식 조합 후 Base64 형식으로 암호화합니다. | ||
rawCode = str(studentID+"^"+timeStamp) | ||
|
||
encodedCode = rawCode.encode('UTF-8') | ||
|
||
resultCode = base64.b64encode(encodedCode) | ||
|
||
resultCodeString = resultCode.decode('ascii') | ||
|
||
print(resultCodeString) | ||
|
||
# QR코드를 표출합니다. | ||
image = qrcode.make(resultCodeString) | ||
image.save("result.png") | ||
# 여기에 코드를 입력하세요. | ||
|
||
# 충남대학교 도서관 어플리케이션과 충남대학교 공식 앱에 뜨는 | ||
# 본인 확인용 QR코드 생성 코드입니다. | ||
|
||
# 이미지가 다운로드 되면 성공입니다. | ||
|
||
# 제작자 : 화학과 24 최민서 | ||
|
||
# 필요한 라이브러리를 import합니다. | ||
import base64 | ||
import time, datetime | ||
import qrcode | ||
from studentinfo import studentID | ||
|
||
# 교번 또는 학번을 입력받습니다. | ||
|
||
# 코드 형식 조합 | ||
now = datetime.datetime.now() | ||
|
||
year = str(now.year) | ||
month = str(now.month) | ||
day = str(now.day) | ||
hour = str(now.hour) | ||
minute = str(now.minute) | ||
second = str(now.second) | ||
|
||
newMonth = month.rjust(2,'0') | ||
newDay = day.rjust(2,'0') | ||
newHour = hour.rjust(2,'0') | ||
newMinute = minute.rjust(2,'0') | ||
newSecond = second.rjust(2,'0') | ||
|
||
timeStamp = str(year + newMonth + newDay + newHour + newMinute + newSecond) | ||
|
||
#Base64 형식으로 암호화 | ||
rawCode = str(studentID+"^"+timeStamp) | ||
encodedCode = rawCode.encode('UTF-8') | ||
resultCode = base64.b64encode(encodedCode) | ||
resultCodeString = resultCode.decode('ascii') | ||
|
||
# QR코드를 표출합니다. | ||
image = qrcode.make(resultCodeString) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
studentID = None | ||
|
||
def setStudentID(ID): | ||
global studentID | ||
studentID = ID | ||
|
||
def getStudentID(): | ||
return studentID |