Registry / workflow / grabfood-api-sdk-python

grabfood-api-sdk-python

JSON →
librarylatest (no versioned releases — install from main branch)pypypiunverified

Official Python SDK for the GrabFood Partner API — enables food delivery merchants and platform partners in Southeast Asia to manage orders, store hours, menus, and campaigns programmatically. Auto-generated from Grab's OpenAPI spec using OpenAPITools PythonClientCodegen. IMPORTANT: This SDK covers GrabFood only (merchant/food delivery). Grab rides/mobility has no official Python SDK. The SDK is not published on PyPI — install via GitHub only.

pip install git+https://github.com/grab/grabfood-api-sdk-python.git
INSTALL
IMPORT
SIG · GRABFOOD-API-SDK-P
G
grabfood-api-sdk-python
workflowpythonvlatest (no versioned releases — install from main branch)
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.930 runs
build_error
glibc
py 3.103.930 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

grabfood
import grabfood
import grab
'grab' on PyPI is a completely unrelated web scraping framework (lorien/grab). pip install grab installs the wrong package entirely.

Authentication is a two-step process: obtain an OAuth token from the auth endpoint, then use it as a Bearer token against the GrabFood partner API. The token must be refreshed manually using the expires_in value from the token response — the SDK does not handle token refresh automatically.

import grabfood from grabfood.configs.config import STG_ENV, PRD_ENV, STG_AUTH_ENV, PRD_AUTH_ENV from grabfood.rest import ApiException # Step 1: Get OAuth token (client credentials flow) # Credentials obtained from Grab Developer Portal CLIENT_ID = 'your_client_id' CLIENT_SECRET = 'your_client_secret' # Auth configuration — use STG_AUTH_ENV for staging, PRD_AUTH_ENV for production auth_config = grabfood.Configuration(host=STG_AUTH_ENV) with grabfood.ApiClient(auth_config) as auth_client: auth_api = grabfood.GetOauthGrabApi(auth_client) oauth_request = grabfood.GrabOauthRequest( client_id=CLIENT_ID, client_secret=CLIENT_SECRET, grant_type='client_credentials', scope='food.partner_api' ) token_response = auth_api.get_oauth_grab('application/json', oauth_request) ACCESS_TOKEN = 'Bearer ' + token_response.access_token # Store token_response.expires_in to know when to refresh # Step 2: Use token against GrabFood API # IMPORTANT: Default host is STG_ENV (sandbox). Switch to PRD_ENV for production. configuration = grabfood.Configuration(host=PRD_ENV) # or STG_ENV for testing MERCHANT_ID = 'your_merchant_id' with grabfood.ApiClient(configuration) as api_client: # Get store hours store_api = grabfood.GetStoreHourApi(api_client) try: response = store_api.get_store_hour( authorization=ACCESS_TOKEN, merchant_id=MERCHANT_ID ) print(response) except ApiException as e: print(f'API error: {e}') # Accept an order order_api = grabfood.AcceptRejectOrderApi(api_client) try: order_api.accept_reject_order( authorization=ACCESS_TOKEN, content_type='application/json', accept_order_request=grabfood.AcceptOrderRequest() ) except ApiException as e: print(f'Order error: {e}')
Debug
Known issues
breakingGrabFood Partner API access requires a signed partnership agreement with Grab. It is not self-serve — you must apply via the Grab Developer Portal and be approved as a merchant or technology partner. Without approval, API credentials are not issued.
fix
Apply for partner access at developer.grab.com before starting integration.
affects: all
gotcha'grab' on PyPI is a completely unrelated Python web scraping framework (github.com/lorien/grab). pip install grab installs the wrong package. The GrabFood SDK is not on PyPI at all.
fix
Install only via GitHub: pip install git+https://github.com/grab/grabfood-api-sdk-python.git
affects: all
gotchaThe SDK default host is STG_ENV (sandbox/staging). Forgetting to switch to PRD_ENV means all production calls hit the sandbox silently — no error is thrown.
fix
Always explicitly set host=PRD_ENV in production: grabfood.Configuration(host=PRD_ENV). Import PRD_ENV from grabfood.configs.config.
affects: all
gotchaOAuth tokens are not auto-refreshed. The SDK returns expires_in in the token response but does not implement token refresh logic. In long-running services, tokens expire and API calls begin returning 401 errors.
fix
Implement token refresh logic using expires_in: store the token issue time, check expiry before each request, and re-authenticate when expired.
affects: all
gotchaThis SDK covers GrabFood (food delivery merchant API) only. There is no official Python SDK for Grab rides, GrabPay, or GrabExpress. Attempting to call non-GrabFood endpoints with this SDK will fail.
fix
For non-GrabFood Grab APIs, use direct HTTP requests against the Grab Partner API with manual OAuth handling.
affects: all
gotchaSDK is auto-generated from OpenAPI spec (PythonClientCodegen). The SDK is geographically scoped — GrabFood operates in Singapore, Malaysia, Indonesia, Thailand, Vietnam, Philippines, Cambodia, and Myanmar. Merchant IDs and API behavior may vary by country.
fix
Verify merchant country scope with Grab during onboarding. Staging environment covers all markets.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'grabfood'
The Python SDK was not installed correctly from its GitHub repository, or the `import` statement uses an incorrect package name.
fix
Install the SDK directly from GitHub using `pip install git+https://github.com/grab/grabfood-api-sdk-python.git`. Ensure your import statement is `import grabfood`.
Unauthorized. The access token is invalid.
The API request was made without a valid or correctly formatted OAuth bearer token in the `Authorization` header, or the token has expired.
fix
Obtain a fresh and valid OAuth access token through the GrabFood Partner API's OAuth flow and include it in your API requests with the `Authorization: Bearer <your_access_token>` header.
grabfood.rest.ApiException: (400) Bad Request
A general API call failure occurred, often due to invalid request parameters, incorrect data format, or missing required fields in the API request body.
fix
Inspect the `ApiException` object's attributes (e.g., `e.status`, `e.reason`, `e.body`) to retrieve detailed error messages from the GrabFood API, then correct your API call's parameters or payload.
Upgrade
Version history
latest (no versioned releases — install from main branch)latest on PyPI
Audit
Dependencies
urllib3requiredRequired. Used for HTTP transport.
python-dateutilrequiredRequired. Used for date/time parsing in API responses.
pydanticrequiredRequired. Request and response models.
Agent activity
55 hits · last 30 days
node
48
OpenAI (training)
1
Resources
grabfood-api-sdk-python — pip install grabfood-api-sdk-python · libregistry