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

walk_set error #80

Closed
greenpasta opened this issue Mar 3, 2017 · 4 comments
Closed

walk_set error #80

greenpasta opened this issue Mar 3, 2017 · 4 comments

Comments

@greenpasta
Copy link

I'm on Python 3.4.5 and the following code:

flickr = flickrapi.FlickrAPI(my_api_key, my_secret_key, format='parsed-json')
photoset = flickr.walk_set('72157640799982165') 

Gives this error:

File "/usr/local/venv/myvenv/lib/python3.4/site-packages/flickrapi/core.py", line 96, in decorated
    raise ValueError(msg % (method.func_name, self.default_format))
AttributeError: 'function' object has no attribute 'func_name'
@sybrenstuvel
Copy link
Owner

sybrenstuvel commented Mar 5, 2017

Good find. We should be using method.__name__ instead of method.func_name. Can you change the code and see if that solves things?

@greenpasta
Copy link
Author

It does clear that error, but now gives me an issue with using parsed-json as the format. While I would prefer JSON, it's not the end of the world for me to use etree.

  File "/usr/local/venv/myvenv/lib/python3.4/site-packages/flickrapi/core.py", line 96, in decorated
    raise ValueError(msg % (method.__name__, self.default_format))
ValueError: Function walk_set requires that you use ElementTree ("etree") as the communication format, while the current format is set to "parsed-json".

@sybrenstuvel
Copy link
Owner

This is documented ("Uses the ElementTree format, incompatible with other formats."), but I understand your fondness of JSON. As an alternative to switching your entire application to ElementTree, you could also extend FlickrAPI.data_walker() so that it also supports JSON. If you do that, I'd suggest renaming the current function to _data_walker_etree() and adding a _data_walker_json(), and then turning data_walker() into a function that calls either one of those depending on the configured format.

If you do this, please send it in as a pull request so that I can merge it into the FlickrAPI library.

sybrenstuvel added a commit that referenced this issue Mar 13, 2017
Closes the 'bug' part of issue #80.
@sybrenstuvel
Copy link
Owner

Closing this ticket as the actual bug is fixed. Feel free to send in a pull request for JSON support in the walker functions.

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