INNER CODE UNIT · Python

fetch_about_data

sunithvs/devb.io · api/main.py:116

async def fetch_about_data(username: Annotated[str, Depends(verify_username)]):
    """Fetch GitHub user's README content"""
    try:
        username = username.strip().lower()
        cache_key = f"github_profile_about:{username}"
        if Settings.CACHE_ENABLED:
            cached_response = await redis_client.get(cache_key)

            if cached_response and not Settings.DEBUG:
                return json.loads(cached_response)

        user_data = await get_cached_github_profile(username)
        data = {
            "about": user_data['about']
        }
        if Settings.CACHE_ENABLED:
            await redis_client.setex(name=cache_key, value=json.dumps(data), time=Settings.DEFAULT_CACHE_TTL)
        return data

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…