espn-api icon indicating copy to clipboard operation
espn-api copied to clipboard

Having Issues with (trades_only) transactions

Open tburge260 opened this issue 5 years ago • 2 comments

Sport

Football

Summary

Hi, I'm trying to write a method to only return the most recent trade, but when trying to use the trades_only arg like in the documentation it's failing.

Thanks a lot love the wrapper!

Logs/Data

if "!trade" in message.content:  
  activitys = league.recent_activity(1, trades_only=True)    
  for activity in activitys:
    for action in activity.actions:
      await message.channel.send(action)
      
Error Log:      

Ignoring exception in on_message Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs) File "main.py", line 71, in on_message activitys = league.recent_activity(1, trades_only=True) TypeError: recent_activity() got an unexpected keyword argument 'trades_only'

tburge260 avatar Sep 22 '21 13:09 tburge260

Hi @tburge260, sorry for late reply it has been a busy week. recent_activity does not have a trades_only flag. If you want to get only trades it should look like this

activitys = league.recent_activity(1, msg_type='TRADED')

You can find the League functions documented here.

I now see the example on the main Football documentation page that is wrong. Sorry about that! Will fix now!

cwendt94 avatar Sep 27 '21 15:09 cwendt94

Thank you!

tburge260 avatar Sep 27 '21 15:09 tburge260