Comments (5)
Changes are in main and will be included in the next release.
from aiohttp-client-cache.
These changes are available in v0.9.
from aiohttp-client-cache.
Could you provide a complete code example that reproduces the problem? I am not familiar with how Sentry interfaces with aiohttp's ClientSession
.
from aiohttp-client-cache.
@JWCook
Hi
I've created a basic example that demonstrates this behavior. It sends two identical requests using, one before initializing Sentry, and a second one after initializing Sentry. The expected behavior is for the client to use the specified request class. But only the first request use CustomRequest
as seen by the printed output
Dependencies:
python = "^3.11"
sentry-sdk = "^1.29.2"
aiohttp = "^3.8.5"
aiohttp-client-cache = {extras = ["all"], version = "^0.8.2"}
Code:
import asyncio
import sentry_sdk
from aiohttp import ClientRequest, ClientResponse
from aiohttp.connector import Connection
from aiohttp_client_cache import CachedSession
class CustomRequest(ClientRequest):
async def send(self, conn: Connection) -> ClientResponse:
print("Custom request class used!")
return await super().send(conn)
async def send_request():
print("Sending a request")
async with CachedSession(request_class=CustomRequest) as session:
await session.get('https://example.org/')
print("Request completed\n")
if __name__ == '__main__':
asyncio.run(send_request())
print("Initializing Sentry and sending another request")
sentry_sdk.init()
asyncio.run(send_request())
stdout:
Sending a request
Custom request class used!
Request completed
Initializing Sentry and sending another request
Sending a request
Request completed
Hope this helps
from aiohttp-client-cache.
Thank you for the details!
It's a bit hard to follow exactly how sentry_sdk.init()
modifies the session, but I can at least confirm that it changes the init signature to __init__(*args, **kwargs)
. I think we can handle this during inspection by checking for the Parameter.VAR_KEYWORD
type.
from aiohttp-client-cache.
Related Issues (20)
- `expire_after` actually doesn't remove key from cache backend (RedisBackend). Is this intended? HOT 4
- Make python-forge an optional/dev dependency only
- Drop support for python 3.7 HOT 2
- Add response filtering options
- .content instance is the same across multiple cached responses (for in-memory backend) HOT 2
- Feature request: support `fsspec` for `FileBackend` HOT 2
- Process hangs until SQLiteBackend instance is closed HOT 13
- python-forge, markdown-it-py dependencies are still mandatory HOT 3
- HTTP responses larger than 400kB are not handeled by DynamoDBBackend HOT 2
- Unit test fixes for FileBackend
- Feature request: FileBackend should honor the cache_name as base directory for all caches (responses and redirects)
- CachedSession does not correctly bypass the cache when caching is disabled via session.disabled()
- Automatically close SQLite connection without using contextmanager HOT 2
- Feature request: Update badge to show build status of main branch HOT 1
- AttributeError: 'CachedResponse' object has no attribute 'closed'
- Add support for python 3.12
- Add more conditional request tests
- Update ".github/workflows/build.yml" with dependabot HOT 3
- Switch to ruff for linting & formatting
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiohttp-client-cache.