0xEssential / opensea-discord-bot

A TS script to hit the OpenSea API for collection sales and send messages to Discord
215 stars 186 forks source link

error not captured in api call #13

Closed quaekr closed 3 years ago

quaekr commented 3 years ago

receive this sometimes which causes the service to crash:

FetchError: invalid json response body at https://api.opensea.io/api/v1/events?offset=0&event_type=successful&only_opensea=false&occurred_after=1631264368&collection_slug=processed-art-mirage&asset_contract_address=0x94edd64585015a3bb06c6061a70fb63ef4bc3cef reason: Unexpected token < in JSON at position 0

assume it's just not handling the error

rssnyder commented 3 years ago

I believe this has something to do with their spam detection. image

ppswaggy commented 3 years ago

I’m having the exact same thing. Anyway to get past this? 066CD171-1842-4235-AA63-8F061E3BB822

rssnyder commented 3 years ago

hey all i was able to solve this by requesting an API token for opensea, and then adding the token into the header: https://github.com/rssnyder/opensea-discord-bot/pull/1

get your token here: https://docs.opensea.io/reference/request-an-api-key

added a pr to add this feature: https://github.com/0xEssential/opensea-discord-bot/pull/16

darrensapalo commented 3 years ago

Thanks @rssnyder , also added #17 which should give more descriptive error messages for rate limiting errors.