Skip to content

Commit

Permalink
docs: Added large file download and cache options (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgp-admin committed Jul 16, 2024
1 parent 41c06c1 commit b1af9eb
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,50 @@ async def async_main() -> dict:
asyncio.run(async_main())
```

## Programmatic use - Download Large Files Using SOAP API
When working with large files, you might find that responses are truncated if they exceed 10MB. This limitation stems from the default settings in Zeep. To overcome this, enable the `xml_huge_tree` option in the Zeep client settings.

```python
ns = NetSuite(config)
# Enable handling of large XML trees
ns.soap_api.client.settings.xml_huge_tree = True
```
## Programmatic use - Adjusting Cache Settings
When deploying applications with strict permissions, you might encounter issues related to caching and more specifically to the location where Zeep library is trying to write its cache SQLite database. You can adjust the cache settings by passing a custom cache parameter via `soap_api_options` when initializing the `NetSuite` or `NetSuiteSoapApi` class.

### Option 1 - Change SQLite path
```python
from netsuite import NetSuite, Config, TokenAuth
from zeep.cache import SqliteCache

config = Config(
account="12345",
auth=TokenAuth(consumer_key="abc", consumer_secret="123", token_id="xyz", token_secret="456"),
)

# Specify SQLite path in soap_api_options
soap_api_options = {"cache": SqliteCache(path='/tmp/sqlite.db', timeout=60)}

ns = NetSuite(config, soap_api_options=soap_api_options)

```

### Option-2 Use InMemoryCache
```python
from netsuite import NetSuite, Config, TokenAuth
from zeep.cache import InMemoryCache

config = Config(
account="12345",
auth=TokenAuth(consumer_key="abc", consumer_secret="123", token_id="xyz", token_secret="456"),
)

# Specify InMemoryCache in soap_api_options
soap_api_options = {"cache": InMemoryCache()}

ns = NetSuite(config, soap_api_options=soap_api_options)
```

## CLI

### Configuration
Expand Down

0 comments on commit b1af9eb

Please sign in to comment.