Skip to main content

Brahm Centre internal utility functions

Project description

bc-utils-package

init.py: This file will be run at the initialization. It will retrieve functions for quick function calling. Instead of "from bc_utils.salesforce import query_salesforce", it can be "from bc_utils import query_salesforce"

Brahm-centre-utils

Brahm-centre-utils is a collection of internal utility functions designed to facilitate common tasks at Brahm Centre. This package includes functions for Salesforce interactions, data processing, and more.

Installation

To install Brahm-centre-utils, you need to have pip and virtualenv set up on your system.

Using pip from a local directory

  1. Clone the repository or download the package to your local machine.
  2. Navigate to the project directory.
  3. Run the following command to install the package:
pip install /path/to/BC-UTILS-PACKAGE

Editable Mode (for development)

If you are developing the package and want changes to be immediately reflected in your projects:

pip install -e /path/to/BC-UTILS-PACKAGE

Usage

After installing the package, you can use the functions provided by Brahm-centre-utils in your projects. Below are some examples.

Salesforce Integration

query_salesforce

This function allows you to query Salesforce data using SOQL (Salesforce Object Query Language).

Example:

from salesforce import query_salesforce

# Use the function to query Salesforce
result = query_salesforce("SELECT Id, Name FROM Account")
print(result)

get_Id_from_SF_URL

This function extracts the Salesforce ID from a given Salesforce URL.

Example:

from salesforce import get_Id_from_SF_URL

# Extract Salesforce ID from URL
sf_id = get_Id_from_SF_URL("https://example.my.salesforce.com/0015g00000WvXXq")
print(sf_id)

Common Utilities

normalize_name

This function normalizes a given name by converting it to lowercase and removing extra spaces.

Example:

from common import normalize_name

# Normalize a name
name = normalize_name(" John Doe ")
print(name)  # Output: "john doe"

Full List of Functions

  • salesforce.query_salesforce
  • salesforce.get_Id_from_SF_URL
  • common.normalize_name
  • common.are_names_similar
  • common.get_unique_names

Configuration

Brahm-centre-utils requires certain environment variables for Salesforce integration. These should be stored in a .env file in the root of your project.

Example .env file

SF_USERNAME=your_salesforce_username
SF_PASSWORD=your_salesforce_password
SF_TOKEN=your_salesforce_security_token
SF_DOMAIN=your_salesforce_domain

Loading Environment Variables

Ensure that you load the environment variables at the start of your script.

from dotenv import load_dotenv
load_dotenv()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brahm_centre_utils-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brahm_centre_utils-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file brahm_centre_utils-0.1.0.tar.gz.

File metadata

  • Download URL: brahm_centre_utils-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for brahm_centre_utils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8c47a73ff7875e397474ac3c5429051c65302cda50e253dc0aa5815a927da8eb
MD5 65837c59839a15ae8f731f987510027a
BLAKE2b-256 7ea491bcf52e1dee2da5c15e9b336cf822ebcf355baa90ffde87f5434e6829c6

See more details on using hashes here.

File details

Details for the file brahm_centre_utils-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for brahm_centre_utils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f84582b8773aeea73a3e2414aa498e6d43cb6e94aadf03c13d53a729013104a
MD5 a3ab6f136b31c406051e8f454087b667
BLAKE2b-256 4a2efe352e4bff3f2cc89a82fb17245f83eb52dc594e407d17219549e18ba3b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page