Closed Shivansh-007 closed 3 years ago
Okay! This now works perfectly when giving it correct options, however if I give it an invalid option, for example i set the outfit to aaaaaaaaaaa
rather than a valid one, instead of getting a 400 bad request I get a 500, so I'd like to see that handled internally too, here's how it's done in normal duck generation, but you may want to refine it: (line 68, ducky.py)
if equipment and equipment not in cls.equipments:
raise HTTPException(400, "Invalid equipment provided.")
if outfit and outfit not in cls.outfits:
raise HTTPException(400, "Invalid outfit provided.")
if hat and hat not in cls.hats:
raise HTTPException(400, "Invalid hat provided.")
Changes mentioned @vcokltfre !
Relevant Issues
Closes #33
Description
This PR does few miscellaneous changes and the major change: allows to pass options while generating a cute man duck.
Miscellaneous Changes:
src/colors.py
, to keep them together and not define them at multiple places.ManDucky
named-tuple to only holdimage
as rest options aren't needed.Major Change
This PR adds two models, one for the Dress Colors of man-ducks and other is the options for generating a man-duck.
This also refactors the man-duck code to not make it repetitive and for each
key
in thetemplate
for generation, there is a tuple, this tuple contains two elements, i.e.Image
object and the color for that object, if there is no color then it is a empty object.