Skip to content

docs: improve usage guide and add facets documentation#441

Closed
techakash32 wants to merge 2 commits intoopenfoodfacts:developfrom
techakash32:fix-docs-facets
Closed

docs: improve usage guide and add facets documentation#441
techakash32 wants to merge 2 commits intoopenfoodfacts:developfrom
techakash32:fix-docs-facets

Conversation

@techakash32
Copy link
Copy Markdown

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
A clear ⚠️ warning about the 10,000 result per request limit
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

@sonarqubecloud
Copy link
Copy Markdown

@techakash32 techakash32 changed the title Improve usage guide and add facets documentation (#69) Improve usage guide and add facets documentation Feb 23, 2026
@techakash32 techakash32 changed the title Improve usage guide and add facets documentation docs: improve usage guide and add facets documentation Feb 23, 2026
@techakash32
Copy link
Copy Markdown
Author

Hi sir, just checking in on this PR. Happy to make any changes if needed! 😊

@raphael0202
Copy link
Copy Markdown
Contributor

Hello @techakash32,
Have you used a LLM to for this PR?

@techakash32
Copy link
Copy Markdown
Author

Hi @raphael0202,

Yes — I used an LLM (ChatGPT) to help draft and improve the documentation wording.
However, I manually verified the content, tested the examples, and ensured the documentation reflects the actual API behavior.

Please let me know if you would like any changes or adjustments.

Comment thread docs/usage.md
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say number of seconds before requests times out

Comment thread docs/usage.md
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should say that the default (Country.world) returns product from the full database (no country filtering)

Comment thread docs/usage.md
| `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` |
Copy link
Copy Markdown
Contributor

@raphael0202 raphael0202 Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default for timeout is not the same as above

@github-project-automation github-project-automation Bot moved this from In progress to Review in progress in 🐍 Python SDK - Keep on par with the API Mar 5, 2026
@raphael0202
Copy link
Copy Markdown
Contributor

Have you read our wiki page regarding GSOC, especially the section regarding LLM usage?
https://wiki.openfoodfacts.org/GSOC#Do_your_%22homework%22

@techakash32 techakash32 closed this by deleting the head repository Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Document or Increase the maximum amount of results using facets

2 participants