Adding custom tags to raven client in runtime

The Django project I am working on is still on the raven client and I need to add custom tags to the sentry requests. I know it can be added using extra arguments when capturing the error but I need it to be more dynamic, something like the scope offered by the current version. Following is the use case:

A specific method of a class runs and it adds a custom tag with say the class name in the scope and if during the execution some error occurs that class name should be added as a custom tag. If it successfully ran the tag should be removed from the scope.

Is it achievable from the raven client?

Look for the *_context methods here: https://docs.sentry.io/clients/python/api/

I.e. Raven.tags_context would take a dictionary that you can use to set some tags for the current request.

The difference is that you can nest scopes in the new SDK while there’s only one thread-local context in Raven that gets cleared at the end of each request.