1

I am using StackAPI (python wrapper) to extract data from Stack Oveflow. Everything works perfectly except when trying to add a filter.

SITE = StackAPI('stackoverflow', key=<my_key>)
answers = SITE.fetch('questions/{ids}/answers?filter=!9_bDE(fI5', ids=[int(q_id)])

I created the filter using the StackExchange API's filter edit function and copied it.

The fetch works perfectly if I remove the ?filter=!9_bDE(fI5' from end point. But that output is useless as I am interested in the answer body.

Could some one please help?

1 Answer 1

1

I was doing it all wrong. Instead of adding the filter as part of the end point, it should be a parameter.

answers = SITE.fetch('questions/{ids}/answers', ids=[int(q_id)], filter='!9_bDE(fI5')

This performed as expected.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.