Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
unsupported operand type(s) for +: 'NoneType' and 'str' 해결해야함
  • Loading branch information
minseo0388 committed Sep 27, 2024
1 parent 0a6625a commit fc2812b
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 51 deletions.
2 changes: 2 additions & 0 deletions .gitignore
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__
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CNUqrcode Software License - Version 1.0 - September 27, 2024
CNUqrweb Software License - Version 1.0 - September 27, 2024

Permission is hereby granted when there is no consent from Chungnam National
University to publish the software code related to Chungnam National
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# CNUqrcode
충남대학교 본인인증 QR코드 생성기
# CNUqrweb
충남대학교 본인인증 QR코드 생성 웹사이트
20 changes: 20 additions & 0 deletions app.py
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)

# 설정시 다시 작동.
91 changes: 43 additions & 48 deletions qrcode.py → qr.py
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)
8 changes: 8 additions & 0 deletions studentinfo.py
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

0 comments on commit fc2812b

Please sign in to comment.