Skip to content
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

photo.getSizes() returns string #130

Open
Matthijz98 opened this issue Jan 2, 2023 · 3 comments
Open

photo.getSizes() returns string #130

Matthijz98 opened this issue Jan 2, 2023 · 3 comments

Comments

@Matthijz98
Copy link

Hi maybe i am doing something wrong but why does photo.getSizes() returns a string?

def test(photoset_id)
        photoset = flickr_api.Photoset(id=photoset_id)
        walker = flickr_api.Walker(photoset.getPhotos)

        # Loop through the pages
        for api_photo in walker:
                for size in api_photo.getSizes():
                    print(type(size))  # <class 'str'>
@beaufour
Copy link
Collaborator

beaufour commented Jan 3, 2023

This maps to the getSizes() API request, which means it likely returns a dict

https://www.flickr.com/services/api/flickr.photos.getSizes.html

@Matthijz98
Copy link
Author

Yes i expected a dict as well but print(type(size)) # <class 'str'> said it is a string.

@beaufour
Copy link
Collaborator

beaufour commented Jan 5, 2023

That's because the keys of the dictionary are strings, and you are iterating over the keys in that loop. Try print(type(api_photo.getSizes()).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants