docs: improve usage guide and add facets documentation#441
docs: improve usage guide and add facets documentation#441techakash32 wants to merge 2 commits intoopenfoodfacts:developfrom
Conversation
|
|
Hi sir, just checking in on this PR. Happy to make any changes if needed! 😊 |
|
Hello @techakash32, |
|
Hi @raphael0202, Yes — I used an LLM (ChatGPT) to help draft and improve the documentation wording. Please let me know if you would like any changes or adjustments. |
| flavor=Flavor.off, # optional — which Open*Facts project | ||
| version=APIVersion.v2, # optional — use v3 for advanced features | ||
| environment=Environment.org, # optional — org=production, net=staging | ||
| timeout=30, # optional — seconds before request fails |
There was a problem hiding this comment.
I would say number of seconds before requests times out
| user_agent="MyAwesomeApp/1.0", # required — describe your app/script | ||
| username=None, # optional — needed for write requests | ||
| password=None, # optional — needed for write requests | ||
| country=Country.world, # optional — filters by country |
There was a problem hiding this comment.
We should say that the default (Country.world) returns product from the full database (no country filtering)
| | `flavor` | Which Open\*Facts project: `off`, `obf`, `opff`, `opf` | `off` | | ||
| | `version` | API version: `v2` (default, stable) or `v3` (required for some features) | `v2` | | ||
| | `environment`| `org` = production (stable) · `net` = staging (for testing/development) | `org` | | ||
| | `timeout` | Request timeout in seconds. Increase if you experience timeout errors. | `10` | |
There was a problem hiding this comment.
The default for timeout is not the same as above
|
Have you read our wiki page regarding GSOC, especially the section regarding LLM usage? |



Description
The Open Food Facts API returns a maximum of 10,000 results per facet request, but this limitation was never documented in the usage guide. Users had no way of knowing the limit existed or how to paginate through results.
Solution
Added a dedicated Facets section to docs/usage.md documenting:
How to use api.facet.get() with page and page_size parameters⚠️ warning about the 10,000 result per request limit
A clear
How to paginate through large datasets using the page parameter
How to access results["products"] from the response
A link to the bulk dataset download as an alternative for large-scale data needs
Note: The 10,000 result limit is enforced server-side by the API and cannot be changed within the SDK. Pagination is the recommended workaround.
Related issue(s)
Fixes #69