Skip to content

Conversation

@amansrivastava17
Copy link

@amansrivastava17 amansrivastava17 commented Sep 15, 2025

Summary

  • Fixed 403 error occurring in load_features() method on self-hosted GrowthBook instances
  • Added proper User-Agent header to HTTP requests made by the Python SDK
  • Headers now include GrowthBook-Python-SDK/{version} format

Problem

The Python SDK was failing with 403 errors when calling load_features() because urllib3.PoolManager() sends minimal
headers by default. Some servers (particularly self-hosted GrowthBook instances with WAF/nginx protection) block
requests without proper User-Agent headers.

Solution

Modified the _get() method in FeatureRepository class to include a proper User-Agent header for all HTTP requests.

Testing

  • MyPy type checking: No new type errors introduced
  • Test suite: All existing tests pass, no functionality broken
  • Flake8 linting: No new linting violations
  • Manual testing: Confirmed load_features() now works on self-hosted instances
  • Feature evaluation and experiment tracking functioning properly

Impact

  • Resolves load_features() failures on self-hosted instances
  • Maintains backward compatibility
  • Improves SDK reliability across different server configurations
  • No breaking changes to existing functionality

The Python SDK was failing with 403 errors when calling load_features()
because urllib3.PoolManager() sends minimal headers by default. Some
servers (including self-hosted GrowthBook instances) block requests
without proper User-Agent headers.

This fix adds a proper User-Agent header in the format:
'GrowthBook-Python-SDK/{version}' to all HTTP requests made by the SDK.

Fixes load_features() 403 errors on self-hosted GrowthBook instances.
Tested with GrowthBook API endpoints and confirmed working.
@vazarkevych vazarkevych self-requested a review September 24, 2025 13:59
@vazarkevych
Copy link
Collaborator

Great fix, small and safe change. Approved.

@vazarkevych
Copy link
Collaborator

Thank you for your contribution!
However, this functionality has already been implemented and released in version 1.4.10.
So this PR can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants