Utilities
The Graphora client library provides utility functions for common tasks. This page provides a reference for all the utility functions in the library.YAML Utilities
load_yaml
Load YAML from a file.Example
save_yaml
Save data as YAML to a file.Example
Environment Utilities
get_api_url
Get the API URL for the specified environment.Example
Best Practices
Working with YAML
When working with YAML files, consider these best practices:-
Handle Exceptions: YAML parsing can fail if the file is malformed
-
Validate Paths: Ensure file paths exist before trying to load or save
-
Use Path Objects: Path objects handle cross-platform path issues
Working with Environment Variables
When working with environment variables, consider these best practices:-
Provide Defaults: Always provide sensible defaults
-
Use Environment Files: Consider using
.envfiles for local development -
Environment-Specific Configuration: Use different configurations for different environments
Complete Example
Here’s a complete example of using the utility functions:Next Steps
- Check out the Client reference
- Learn about Models
- Explore the Exceptions module
