Skip to content

Commit 6f90c20

Browse files
committed
Bump version
1 parent 7e20f8d commit 6f90c20

File tree

5 files changed

+30
-15
lines changed

5 files changed

+30
-15
lines changed

dymopy/client.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ def make_xml(top='Hello', bottom='World'):
171171

172172
return resp.strip().replace('\n', '')
173173

174-
def make_params(side="Left"):
174+
def make_params(copies=1, side="Left"):
175175
"""
176176
Arguments:
177+
copies: str
177178
side:str
178179
Choose the left or right side of the roll if using Dymo Twin Turbo.
179180
"""
180-
return '<LabelWriterPrintParams><TwinTurboRoll>{}</TwinTurboRoll></LabelWriterPrintParams>'.format(side)
181-
181+
return f'<LabelWriterPrintParams><Copies>{str(copies)}</Copies><TwinTurboRoll>{str(side)}</TwinTurboRoll></LabelWriterPrintParams>'

examples/input.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# test out the endpoint
2+
import requests
3+
from dymopy import Dymo
4+
from dymopy.client import make_params
5+
6+
base_url = 'http://localhost:3000'
7+
body = {
8+
'top': 'hello',
9+
'bottom': 'world',
10+
'copies': str(1),
11+
'side': 'Left'}
12+
13+
resp = requests.post(base_url, params=body)
14+
resp.json()

examples/main.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77
dymo = Dymo()
88

99
@app.post('/')
10-
def print(labelXml, printParams):
11-
label_xml = make_xml()
12-
label_params = make_params()
13-
# dymo.print()
14-
return {
15-
'Label': label_xml,
16-
'Params': label_params
17-
}
10+
def print(top:str, bottom:str, copies: str, side:str):
11+
label_xml = make_xml(top=top, bottom=bottom)
12+
label_params = make_params(copies=copies, side=side)
13+
resp = dymo.print(label_xml=label_xml, label_params=label_params)
14+
15+
if resp.status_code == 200:
16+
return True
17+
else:
18+
return False
1819

1920
if __name__ == "__main__":
20-
uvicorn.run("main:app", host="127.0.0.1", port=5000, log_level="info")
21+
uvicorn.run("main:app", host="127.0.0.1", port=3000, log_level="info")
2122

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = dymopy
3-
version = 0.1.2
3+
version = 0.1.3
44
author = Bill Ash
55
author_email = bill@overco.net
66
description = API wrapper for DYMO Web Services.

tests/test_dymopy.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_printer_job():
2828
label_params = make_params()
2929
label_xml = make_xml('Hello', 'World!')
3030

31-
print_resp = dymo.print(label_xml=label_xml, label_params=label_params)
32-
assert print_resp.status_code == 200
31+
# print_resp = dymo.print(label_xml=label_xml, label_params=label_params)
32+
# assert print_resp.status_code == 200
3333

3434

0 commit comments

Comments
 (0)