openfoodfacts / openfoodfacts-python

🐍 Python package for Open Food Facts
https://openfoodfacts.github.io/openfoodfacts-python/
Other
312 stars 66 forks source link

Inconsistency in User Agent Specification in Documentation #206

Open floodoo opened 8 months ago

floodoo commented 8 months ago

Issue: User Agent Parameter Missing in OpenFoodFacts SDK Despite Documentation

What

A discrepancy has been identified in the OpenFoodFacts SDK documentation regarding the ability to set a user agent. The documentation suggests setting a user agent during API initialization, but the SDK's API class constructor does not support this functionality.

Steps to Observe the Discrepancy

  1. The documentation indicates the use of a user_agent parameter in the API initialization as follows:
    api = API(
        user_agent="<application name>",
        ...
    )
  2. However, the actual API class constructor in the SDK lacks the user_agent parameter:
    class API:
        def __init__(
            self,
            username: Optional[str] = None,
            ...
        ) -> None:
            ...

Expected Behavior

The SDK's documentation should accurately reflect its current functionality. If the SDK is intended to support the user_agent parameter, this should be correctly implemented. If not, the documentation should be updated to avoid such mentions.

Suggested Action

Based on this inconsistency, I recommend either:

Platform

Context of Discovery

I look forward to a resolution that aligns the SDK with its documentation, ensuring clarity for all future users.

namedtoaster commented 8 months ago

I think this only happens if you install the package with pip. I had the same issue. But when I cloned the repo and installed via setup.py, that worked for me. I'm guessing the pypi package just isn't up to date?

elebumm commented 6 months ago

Confirming that the pypi package isn't up to date. Running:

pip install git+https://github.com/openfoodfacts/openfoodfacts-python#egg=openfoodfacts

was what fixed it for me.