Skip to content

Commit

Permalink
edit: edit canon printing server address.
Browse files Browse the repository at this point in the history
  • Loading branch information
KyoungsueKim committed Feb 23, 2024
1 parent b84fc68 commit 16f5b91
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions verbose-waffle/core/printers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import requests
import random

import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)


def get_page_cnt(id: str) -> int:
with open(f'temp/{id}.pdf', 'rb') as pdf_file:
Expand All @@ -15,7 +18,7 @@ def get_page_cnt(id: str) -> int:

def __print_to_file(id: str):
# Create Virtual Printer
subprocess.check_call(f'lpadmin -p {id} -v file:///root/{id}.prn -E -m CNRCUPSIRADV45453ZK.ppd'.split(' '))
subprocess.check_call(f'lpadmin -p {id} -v file:///root/{id}.prn -E -m CNRCUPSIRADVC35253ZK.ppd'.split(' '))

# Print pdf file via the virtual printer
subprocess.check_call(f'lpr -P {id} -o ColorModel=KGray temp/{id}.pdf'.split(' '))
Expand All @@ -35,15 +38,16 @@ def __print_to_file(id: str):
def send_print_data(id: str):
if __print_to_file(id) is not None:
file_name = f"{id}.prn"
server = 'http://218.145.52.6:8080/spbs/upload_bin'
server = 'https://218.145.52.21:65443/spbs/upload_bin'
header = {'Content-Type': 'application/X-binary; charset=utf-8',
'User-Agent': None,
'Content-Disposition': f"attachment; filename={file_name}",
'Expect': "100-continue"}
data = open(f'/root/{file_name}', 'rb')
response = requests.post(url=server,
headers=header,
data=data)
data=data,
verify=False)

return response

Expand All @@ -53,7 +57,7 @@ def send_print_data(id: str):

def send_register_doc(id: str, doc_name: str, phone_number: str, cnt: int, isA3: bool = False):
file_name = f"{id}.prn"
server = 'http://u-printon.canon-bs.co.kr:62301/nologin/regist_doc/'
server = 'http://u-printon.kr.canon:62301/nologin/regist_doc/'
header = {'Content-Type': 'application/json; charset=utf-8',
'User-Agent': None,
'Content-Disposition': f"attachment; filename={file_name}",
Expand All @@ -79,7 +83,8 @@ def send_register_doc(id: str, doc_name: str, phone_number: str, cnt: int, isA3:
}
response = requests.post(url=server,
headers=header,
json=json)
json=json,
verify=False)

return response

Expand Down

0 comments on commit 16f5b91

Please sign in to comment.