-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parse url to set parameters and return parameters as dict #1
Conversation
@@ -108,3 +108,125 @@ def format(self, image_format): | |||
img = self.get_copy() | |||
img.image_options['format'] = image_format | |||
return img | |||
|
|||
def parse_from_url(self, url): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems pretty slick - it lets you can initialize an image client instance from a url? I think maybe it would be a bit cleaner to make it a classmethod and return a new instance. And what do you think of calling it init_from_url
instead of parse?
All sound like excellent ideas, thanks for the feedback. Will give those changes a go and update this pull request. |
All the updates look good. Given that the last commit is "pre-tests" is it fair to assume more is coming on the unit tests? Also, might be good to declare and use a custom exception class, just to make it easier to catch and identify. |
Alrighty, think I've addressed most of your suggestions:
Thanks again for taking the time to look over the initial PR and provide feedback, it was pretty rough around the edges the first go. |
Updates look good. I'll try to get it merged in and maybe make another release soon. |
Awesome, thanks. |
@ghukill I'm doing some clean up and extending the unit tests based on your additions, and I'm wondering if it would make more sense to store the options internally as dictionaries rather than strings. That would mean options provided at init would be parsed and checked (which they currently aren't), and seems like it might be a more logical approach in general. Thoughts? |
That's a great idea. I had originally envisioned methods like |
I'm going to go ahead and close this pull request, since the code is merged into develop and documented in the change log. Thanks for the contribution! |
Not sure at all if this is in scope for the IIIFImageClient, but thought it was worth throwing out there.
Would be two additions:
api_endpoint
,image_id
,region
,size
,rotation
,quality
, andformat
of the client instanceregion
,size
, androtation
We have a use case where we want to determine the height and/or width that a URL is requesting, and whether or not it's mirrored. These two additions make that pretty easy given a URL.
e.g.
Either way, thanks for breaking this into it's own package! Mighty handy.