Gus Python library that allows for simple SOQL queries on GUS, as well as Authentication to GUS.
** There is a substantial change to the format of querying in v2.0+, where it allows for more specific filters and arrangement of the data acquired from GUS
To install, simply use your virtualenv:
pip install guspy
To repackage, change the version number of the setup.py
file
python3 setup.py bdist_wheel
python3 -m twine upload dist/*
Example:
query = Case(
fields=<FIELDS REQUIRED (list or str)>,
filters=<FILTERS EXPECTED>,
limit=<TOTAL NUMBER OF RESULTS>,
sort_by=<FIELD TO SORT BY>,
sort_seq=<ASC or DESC>
)
Filters
help to improve the specificity of the query that you want. Similar to excel commands, you encapsulate everything in brackets ()
from guspy.filters import *
## Equals ##
equals("CaseNumber", "8938202")
# Returns "CaseNumber = '8938202'"
## Within ##
is_in("CaseNumber", ["8190582","8190583"])
# Returns "CaseNumber IN ('8190582','8190583')"
## Like ##
like("CaseNumber", "389*", identifier="*")
# Returns "CaseNumber LIKE '389%'"
# This means to return all items that CaseNumber starts with 389
## Including ##
incl(filter_1, filter_2, filter_3)
# Returns "filter_1 AND filter_2 AND filter_3"
## Excluding ##
excl(filter_1, filter_2, filter_3)
# Returns "filter_1 OR filter_2 OR filter_3"
## Quote ##
quote(938859)
# Returns "'938859'"
## Bracket ##
bracket(938859)
# Returns "(938859)"
For GUS Objects not found in the document below, you can find out what the name of the GUS Object is, and call the query similarly with the following commands:
from guspy import GUSObject
object = GUSObject(fields=<FIELDS>, filters=<FILTERS>)
object.query_object(<NAME OF GUS OBJECT>)
query = object.generate()
To be updated
To be updated
Case
class can be initialised with the case number or list of case numbers. In which the single case_number would be using from_single
method, and the list of case_numbers will be using the from_multiple
method.
from guspy import Case
query = Case(
fields="Id, CaseNumber, Release__c",
filters=is_in(CaseNumber, ["8190582","8190583"]),
sort_by="LastModified",
sort_seq="DESC"
)
query = Case(
fields="Id, CaseNumber, Release__c",
filters=equals(CaseNumber, "8190582"),
sort_by="LastModified",
sort_seq="DESC"
)
To be updated
To be updated
To be updated
To be updated
To be updated
To be updated
To be updated
To be updated
To be updated
To be updated
To be updated
To be updated
To be updated
To be updated
from guspy.access import Gus
gus = Gus(username=<USERNAME@ORGANIZATION>,
password=<PASSWORD>,
otp=<2FA TOKEN>).connect()
Take note to login with the organization provided. For internal salesforce users, either use @salesforce.com or @gus.com, etc.
Upon logging in, use the commands above to get the query string for the object required (CaseComments, ReleaseEvents, etc.) before executing the following command:
gus.raw(<REQUIRED_QUERY>)
gus.parse(<REQUIRED_QUERY>)
Where raw
will return the raw data, and parse
will return in a DataFrame format.
If unable to access after a certain time, please execute the following with a fresh 2FA token to reconnect:
gus.reconnect(otp=<2FA TOKEN>)
To be updated
To be updated
To be updated