rollbar / pyrollbar

Error tracking and logging from Python to Rollbar
https://docs.rollbar.com/docs/python/
MIT License
213 stars 135 forks source link

Do not force the requests module to always be included #422

Open phillipuniverse opened 1 year ago

phillipuniverse commented 1 year ago

Description of the change

Allows the module to work if requests is not available.

Type of change

Related issues

Shortcut stories and GitHub issues (delete irrelevant)

Checklists

Development

Code review

phillipuniverse commented 1 year ago

I really just wanted to get this out quickly to see what CI would say, I'm not very confidant in my changes there. I was also surprised that all of the tests passed locally with no other changes but maybe that's a good thing?

I tried to make as small and as targeted of a change as possible but it's tricky, there is a lot of "hand shake" type of agreements. I don't have a ton of confidence that a user wouldn't get into a code path that refers to the requests module.

But I suppose if all the tests pass in the FastAPI/Starlette environments that doesn't have requests installed then maybe we're in the clear.

phillipuniverse commented 1 year ago

@danielmorell could I get some feedback on my solution here? Is this in the right direction?

danielmorell commented 1 year ago

Hey @phillipuniverse, sorry for the long wait! Overall, I think this is moving in the right direction, and solving a very real problem. Thank you for your work on this!

It may make sense to check if requests is available when Rollbar is initialized instead of waiting until we try to process the first error message. I feel like letting the developer know as soon as possible that they have configured a state that won't work would be best.

What do you think?