doordash-rest-client


Namedoordash-rest-client JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryA comprehensive Python client for the DoorDash API
upload_time2025-08-08 03:11:49
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2024 DoorDash Automation Suite Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords api client delivery doordash food ordering
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DoorDash Python Client

A simple Python client for the DoorDash API.

## Installation

```bash
pip install doordash-rest-client
```

## Quick Start

```python
from doordash_client import DoorDashClient

# Initialize client
client = DoorDashClient(
    org_id="your-org-id"
)

# Acquire a session (address required for new users)
client.acquire_session(
    name="John Doe",
    phone="555-1234", 
    address="123 Main St, New York, NY"
)

# Search for restaurants
restaurants = client.search_restaurants(query="pizza", lat=40.7128, lng=-74.0060)

# Add items to cart
client.add_to_cart(store_id=12345, item_id=67890, quantity=2)

# View cart
cart = client.view_cart()

# Place order
order = client.place_order(tip_amount=5.00)

# Release session when done
client.release_session()
```

## API Methods

### Session Management
- `acquire_session(ttl_minutes=60, **kwargs)` - Acquire a session (address required for new users)
- `release_session()` - Release the session (automatically saves address snapshots)
- `health_check()` - Check API health
- `system_status()` - Get system status

### 🏠 Address Isolation System
- **Complete Privacy**: Users never see other users' addresses
- **Automatic Management**: Address isolation happens transparently
- **Perfect Restoration**: Addresses restored exactly as saved across sessions
- **Zero Configuration**: No manual snapshot management required

### Restaurant Search
- `search_restaurants(query=None, lat=None, lng=None, limit=10)` - Search restaurants
- `get_restaurant(store_id)` - Get restaurant details
- `get_menu_item(store_id, item_id)` - Get menu item details

### Cart Management
- `add_to_cart(store_id, item_id, quantity=1, **kwargs)` - Add item to cart
- `view_cart()` - View current cart
- `clear_carts()` - Clear all carts
- `get_bundle_opportunities(cart_id)` - Get multi-store bundle options

### Orders
- `place_order(tip_amount=0.0, **kwargs)` - Place an order

### Addresses
- `get_addresses()` - Get user addresses
- `add_address(street, city, state, zipcode, **kwargs)` - Add new address
- `get_address_suggestions(query)` - Get address suggestions (requires session)
- `get_standalone_address_suggestions(address_input)` - Get address suggestions without session

### Payment Methods
- `get_payment_methods()` - Get payment methods
- `add_payment_method(**kwargs)` - Add payment method
- `get_credit_balance()` - Get account credit balance

### Grocery
- `browse_grocery(store_id)` - Browse grocery store
- `search_grocery(store_id, query)` - Search grocery items

### Snapshots
- `save_snapshot()` - Save session snapshot
- `restore_snapshot()` - Restore session snapshot

## Configuration

The client supports these initialization parameters:

- `org_id` (required): Your organization ID (serves as both ID and API key)
- `base_url`: API base URL (defaults to production)
- `client_id`: Optional client ID (auto-generated if not provided)
- `timeout`: Request timeout in seconds (default: 30.0)

## Error Handling

The client raises these exceptions:

- `APIError`: API returned an error response
- `NetworkError`: Network request failed
- `AuthenticationError`: Authentication failed

```python
from doordash_client import DoorDashClient, APIError, NetworkError

try:
    client = DoorDashClient(org_id="your-org-id")
    result = client.health_check()
except APIError as e:
    print(f"API error: {e.message} (status: {e.status_code})")
except NetworkError as e:
    print(f"Network error: {e}")
```

## Examples

### Complete Ordering Flow

```python
from doordash_client import DoorDashClient

client = DoorDashClient(org_id="your-org-id")

try:
    # 1. Acquire session (address required for new users)
    session = client.acquire_session(
        name="John Doe", 
        phone="555-555-1234",
        address="123 Main St, New York, NY"
    )
    
    # 2. Search for restaurants
    restaurants = client.search_restaurants(
        query="mexican food",
        lat=40.7128,
        lng=-74.0060,
        limit=5
    )
    
    # 3. Get restaurant details
    store_id = restaurants["results"][0]["id"]
    restaurant = client.get_restaurant(store_id)
    
    # 4. Add items to cart
    client.add_to_cart(
        store_id=store_id,
        item_id=12345,
        quantity=2,
        special_instructions="Extra spicy please"
    )
    
    # 5. View cart
    cart = client.view_cart()
    print(f"Cart total: ${cart['total']}")
    
    # 6. Place order
    order = client.place_order(
        tip_amount=8.00,
        delivery_instructions="Leave at door"
    )
    
    print(f"Order placed! ID: {order['order_id']}")
    
finally:
    # Always release session
    client.release_session()
```

### Using Address Management

```python
# Get standalone address suggestions (no session required)
standalone_suggestions = client.get_standalone_address_suggestions("123 Main St, San Francisco")
print(f"Found {len(standalone_suggestions['suggestions'])} suggestions")
for suggestion in standalone_suggestions['suggestions']:
    print(f"- {suggestion['formatted_address']}")
    print(f"  Serviceable: {suggestion['market_info']['serviceable']}")

# Get address suggestions (requires active session)
suggestions = client.get_address_suggestions("123 Main St, New York")

# Add a new address
address = client.add_address(
    street="123 Main Street",
    city="New York", 
    state="NY",
    zipcode="10001",
    delivery_instructions="Apartment 4B"
)

# Get all addresses
addresses = client.get_addresses()
```

### Multi-Store Ordering (DoubleDash)

```python
# Add items from first restaurant
client.add_to_cart(store_id=111, item_id=1, quantity=1)

# View cart to get cart_id
cart = client.view_cart()
cart_id = cart["id"]

# Get bundle opportunities (other compatible stores)
opportunities = client.get_bundle_opportunities(cart_id)

# Add items from compatible store
client.add_to_cart(store_id=222, item_id=2, quantity=1)

# Place combined order
order = client.place_order(tip_amount=10.00)
```

## 🏠 Address Isolation System

### Complete Privacy & Security

The DoorDash Python Client includes a sophisticated Address Isolation System that ensures complete privacy between users while maintaining seamless address persistence.

### Key Features

- **🔒 Complete Isolation**: Users never see other users' addresses
- **💾 Automatic Restoration**: Addresses automatically restored across sessions
- **🛡️ Zero Contamination**: Address validation doesn't pollute tenant accounts
- **⚡ Transparent Operation**: Works automatically without configuration

### How It Works

```python
# First time user - address required
client = DoorDashClient(org_id="your-org-id")
session = client.acquire_session(
    name="New User",
    phone="555-1234",
    address="123 Main St, San Francisco, CA"  # Required for new users
)

# Address is validated and stored securely
# Session work...
client.release_session()  # Address automatically saved to snapshot

# Later - existing user
session = client.acquire_session(
    name="New User",
    phone="555-1234"
    # No address needed - automatically restored from snapshot
)
# User's addresses are automatically restored exactly as they were
```

### Address Management

```python
# Validate addresses before registration (no session required)
suggestions = client.get_standalone_address_suggestions("123 Main St, SF")
for suggestion in suggestions['suggestions']:
    print(f"Address: {suggestion['formatted_address']}")
    print(f"Serviceable: {suggestion['market_info']['serviceable']}")

# Session-based address management
client.acquire_session(name="User", phone="555-1234", address="Valid Address")

# Get all user addresses
addresses = client.get_addresses()

# Add additional addresses
client.add_address(
    street="456 Oak Ave",
    city="San Francisco", 
    state="CA",
    zipcode="94102"
)
```

### Privacy Guarantees

- ✅ **Zero Cross-Pollution**: Users never see addresses from other users
- ✅ **Tenant Protection**: System default addresses never exposed to users
- ✅ **Clean Validation**: Address validation uses read-only operations only
- ✅ **Perfect Restoration**: Addresses restored exactly as saved
- ✅ **Automatic Cleanup**: User addresses removed from tenant during session release

## License

MIT License
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "doordash-rest-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "DoorDash Automation Suite <support@example.com>",
    "keywords": "api, client, delivery, doordash, food, ordering",
    "author": null,
    "author_email": "DoorDash Automation Suite <support@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/0d/63/8d5ac64df18c2b80f8abb2b331d8cbc1dcabacc6a5783e450e51d5dcbe30/doordash_rest_client-0.1.3.tar.gz",
    "platform": null,
    "description": "# DoorDash Python Client\n\nA simple Python client for the DoorDash API.\n\n## Installation\n\n```bash\npip install doordash-rest-client\n```\n\n## Quick Start\n\n```python\nfrom doordash_client import DoorDashClient\n\n# Initialize client\nclient = DoorDashClient(\n    org_id=\"your-org-id\"\n)\n\n# Acquire a session (address required for new users)\nclient.acquire_session(\n    name=\"John Doe\",\n    phone=\"555-1234\", \n    address=\"123 Main St, New York, NY\"\n)\n\n# Search for restaurants\nrestaurants = client.search_restaurants(query=\"pizza\", lat=40.7128, lng=-74.0060)\n\n# Add items to cart\nclient.add_to_cart(store_id=12345, item_id=67890, quantity=2)\n\n# View cart\ncart = client.view_cart()\n\n# Place order\norder = client.place_order(tip_amount=5.00)\n\n# Release session when done\nclient.release_session()\n```\n\n## API Methods\n\n### Session Management\n- `acquire_session(ttl_minutes=60, **kwargs)` - Acquire a session (address required for new users)\n- `release_session()` - Release the session (automatically saves address snapshots)\n- `health_check()` - Check API health\n- `system_status()` - Get system status\n\n### \ud83c\udfe0 Address Isolation System\n- **Complete Privacy**: Users never see other users' addresses\n- **Automatic Management**: Address isolation happens transparently\n- **Perfect Restoration**: Addresses restored exactly as saved across sessions\n- **Zero Configuration**: No manual snapshot management required\n\n### Restaurant Search\n- `search_restaurants(query=None, lat=None, lng=None, limit=10)` - Search restaurants\n- `get_restaurant(store_id)` - Get restaurant details\n- `get_menu_item(store_id, item_id)` - Get menu item details\n\n### Cart Management\n- `add_to_cart(store_id, item_id, quantity=1, **kwargs)` - Add item to cart\n- `view_cart()` - View current cart\n- `clear_carts()` - Clear all carts\n- `get_bundle_opportunities(cart_id)` - Get multi-store bundle options\n\n### Orders\n- `place_order(tip_amount=0.0, **kwargs)` - Place an order\n\n### Addresses\n- `get_addresses()` - Get user addresses\n- `add_address(street, city, state, zipcode, **kwargs)` - Add new address\n- `get_address_suggestions(query)` - Get address suggestions (requires session)\n- `get_standalone_address_suggestions(address_input)` - Get address suggestions without session\n\n### Payment Methods\n- `get_payment_methods()` - Get payment methods\n- `add_payment_method(**kwargs)` - Add payment method\n- `get_credit_balance()` - Get account credit balance\n\n### Grocery\n- `browse_grocery(store_id)` - Browse grocery store\n- `search_grocery(store_id, query)` - Search grocery items\n\n### Snapshots\n- `save_snapshot()` - Save session snapshot\n- `restore_snapshot()` - Restore session snapshot\n\n## Configuration\n\nThe client supports these initialization parameters:\n\n- `org_id` (required): Your organization ID (serves as both ID and API key)\n- `base_url`: API base URL (defaults to production)\n- `client_id`: Optional client ID (auto-generated if not provided)\n- `timeout`: Request timeout in seconds (default: 30.0)\n\n## Error Handling\n\nThe client raises these exceptions:\n\n- `APIError`: API returned an error response\n- `NetworkError`: Network request failed\n- `AuthenticationError`: Authentication failed\n\n```python\nfrom doordash_client import DoorDashClient, APIError, NetworkError\n\ntry:\n    client = DoorDashClient(org_id=\"your-org-id\")\n    result = client.health_check()\nexcept APIError as e:\n    print(f\"API error: {e.message} (status: {e.status_code})\")\nexcept NetworkError as e:\n    print(f\"Network error: {e}\")\n```\n\n## Examples\n\n### Complete Ordering Flow\n\n```python\nfrom doordash_client import DoorDashClient\n\nclient = DoorDashClient(org_id=\"your-org-id\")\n\ntry:\n    # 1. Acquire session (address required for new users)\n    session = client.acquire_session(\n        name=\"John Doe\", \n        phone=\"555-555-1234\",\n        address=\"123 Main St, New York, NY\"\n    )\n    \n    # 2. Search for restaurants\n    restaurants = client.search_restaurants(\n        query=\"mexican food\",\n        lat=40.7128,\n        lng=-74.0060,\n        limit=5\n    )\n    \n    # 3. Get restaurant details\n    store_id = restaurants[\"results\"][0][\"id\"]\n    restaurant = client.get_restaurant(store_id)\n    \n    # 4. Add items to cart\n    client.add_to_cart(\n        store_id=store_id,\n        item_id=12345,\n        quantity=2,\n        special_instructions=\"Extra spicy please\"\n    )\n    \n    # 5. View cart\n    cart = client.view_cart()\n    print(f\"Cart total: ${cart['total']}\")\n    \n    # 6. Place order\n    order = client.place_order(\n        tip_amount=8.00,\n        delivery_instructions=\"Leave at door\"\n    )\n    \n    print(f\"Order placed! ID: {order['order_id']}\")\n    \nfinally:\n    # Always release session\n    client.release_session()\n```\n\n### Using Address Management\n\n```python\n# Get standalone address suggestions (no session required)\nstandalone_suggestions = client.get_standalone_address_suggestions(\"123 Main St, San Francisco\")\nprint(f\"Found {len(standalone_suggestions['suggestions'])} suggestions\")\nfor suggestion in standalone_suggestions['suggestions']:\n    print(f\"- {suggestion['formatted_address']}\")\n    print(f\"  Serviceable: {suggestion['market_info']['serviceable']}\")\n\n# Get address suggestions (requires active session)\nsuggestions = client.get_address_suggestions(\"123 Main St, New York\")\n\n# Add a new address\naddress = client.add_address(\n    street=\"123 Main Street\",\n    city=\"New York\", \n    state=\"NY\",\n    zipcode=\"10001\",\n    delivery_instructions=\"Apartment 4B\"\n)\n\n# Get all addresses\naddresses = client.get_addresses()\n```\n\n### Multi-Store Ordering (DoubleDash)\n\n```python\n# Add items from first restaurant\nclient.add_to_cart(store_id=111, item_id=1, quantity=1)\n\n# View cart to get cart_id\ncart = client.view_cart()\ncart_id = cart[\"id\"]\n\n# Get bundle opportunities (other compatible stores)\nopportunities = client.get_bundle_opportunities(cart_id)\n\n# Add items from compatible store\nclient.add_to_cart(store_id=222, item_id=2, quantity=1)\n\n# Place combined order\norder = client.place_order(tip_amount=10.00)\n```\n\n## \ud83c\udfe0 Address Isolation System\n\n### Complete Privacy & Security\n\nThe DoorDash Python Client includes a sophisticated Address Isolation System that ensures complete privacy between users while maintaining seamless address persistence.\n\n### Key Features\n\n- **\ud83d\udd12 Complete Isolation**: Users never see other users' addresses\n- **\ud83d\udcbe Automatic Restoration**: Addresses automatically restored across sessions\n- **\ud83d\udee1\ufe0f Zero Contamination**: Address validation doesn't pollute tenant accounts\n- **\u26a1 Transparent Operation**: Works automatically without configuration\n\n### How It Works\n\n```python\n# First time user - address required\nclient = DoorDashClient(org_id=\"your-org-id\")\nsession = client.acquire_session(\n    name=\"New User\",\n    phone=\"555-1234\",\n    address=\"123 Main St, San Francisco, CA\"  # Required for new users\n)\n\n# Address is validated and stored securely\n# Session work...\nclient.release_session()  # Address automatically saved to snapshot\n\n# Later - existing user\nsession = client.acquire_session(\n    name=\"New User\",\n    phone=\"555-1234\"\n    # No address needed - automatically restored from snapshot\n)\n# User's addresses are automatically restored exactly as they were\n```\n\n### Address Management\n\n```python\n# Validate addresses before registration (no session required)\nsuggestions = client.get_standalone_address_suggestions(\"123 Main St, SF\")\nfor suggestion in suggestions['suggestions']:\n    print(f\"Address: {suggestion['formatted_address']}\")\n    print(f\"Serviceable: {suggestion['market_info']['serviceable']}\")\n\n# Session-based address management\nclient.acquire_session(name=\"User\", phone=\"555-1234\", address=\"Valid Address\")\n\n# Get all user addresses\naddresses = client.get_addresses()\n\n# Add additional addresses\nclient.add_address(\n    street=\"456 Oak Ave\",\n    city=\"San Francisco\", \n    state=\"CA\",\n    zipcode=\"94102\"\n)\n```\n\n### Privacy Guarantees\n\n- \u2705 **Zero Cross-Pollution**: Users never see addresses from other users\n- \u2705 **Tenant Protection**: System default addresses never exposed to users\n- \u2705 **Clean Validation**: Address validation uses read-only operations only\n- \u2705 **Perfect Restoration**: Addresses restored exactly as saved\n- \u2705 **Automatic Cleanup**: User addresses removed from tenant during session release\n\n## License\n\nMIT License",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2024 DoorDash Automation Suite\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "A comprehensive Python client for the DoorDash API",
    "version": "0.1.3",
    "project_urls": {
        "Changelog": "https://github.com/doordash-automation/python-client/blob/main/CHANGELOG.md",
        "Documentation": "https://doordash-automation.github.io/python-client/",
        "Homepage": "https://github.com/doordash-automation/python-client",
        "Issues": "https://github.com/doordash-automation/python-client/issues",
        "Repository": "https://github.com/doordash-automation/python-client.git"
    },
    "split_keywords": [
        "api",
        " client",
        " delivery",
        " doordash",
        " food",
        " ordering"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "93b24d1a04b8a916df07d6eab7204e036a8aa1ee09e9a860f24ea1487852b817",
                "md5": "3551055e13ba42f8a00a6bfef3acc43d",
                "sha256": "b09b89151651d492c9aeb14489e422a5d04832a9188fb82d10ab2784648b184a"
            },
            "downloads": -1,
            "filename": "doordash_rest_client-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3551055e13ba42f8a00a6bfef3acc43d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9461,
            "upload_time": "2025-08-08T03:11:48",
            "upload_time_iso_8601": "2025-08-08T03:11:48.525209Z",
            "url": "https://files.pythonhosted.org/packages/93/b2/4d1a04b8a916df07d6eab7204e036a8aa1ee09e9a860f24ea1487852b817/doordash_rest_client-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0d638d5ac64df18c2b80f8abb2b331d8cbc1dcabacc6a5783e450e51d5dcbe30",
                "md5": "08766e3cf7a7e1db0b5e96ae46baa055",
                "sha256": "ea5cead2b92e2c246d82bb65b3866c0901a0088fd06c528051e03a04ee8281ac"
            },
            "downloads": -1,
            "filename": "doordash_rest_client-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "08766e3cf7a7e1db0b5e96ae46baa055",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 12022,
            "upload_time": "2025-08-08T03:11:49",
            "upload_time_iso_8601": "2025-08-08T03:11:49.782676Z",
            "url": "https://files.pythonhosted.org/packages/0d/63/8d5ac64df18c2b80f8abb2b331d8cbc1dcabacc6a5783e450e51d5dcbe30/doordash_rest_client-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-08 03:11:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "doordash-automation",
    "github_project": "python-client",
    "github_not_found": true,
    "lcname": "doordash-rest-client"
}
        
Elapsed time: 0.49340s