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?

akalanka
  • 553
  • 7
  • 21

1 Answers1

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.

akalanka
  • 553
  • 7
  • 21