SoftExpertAPI
Esta lib fornece um wrapper às APIs SoftExpert
Getting Stated
Instalar a Lib:
pip install SoftExpertAPI
Configurar e criar uma instância:
from SoftExpertAPI import SoftExpertException, SoftExpertOptions, SoftExpertWorkflowApi
option = SoftExpertOptions(
url = "https://softexpert.com",
authorization = "Basic SEU_TOKEN", # pode ser Basic ou Bearer
userID = "sistema.automatico" # Matricula do usuário padrão das operações. Pode ser informado usuário diferente em cada endpoint chamado
)
api = SoftExpertWorkflowApi(option)
Criar instância de Workflow
try:
instancia = api.newWorkflow(ProcessID="SM", WorkflowTitle="Apenas um teste")
print(f"Instancia criada com sucesso: {instancia}")
except SoftExpertException as e:
print(f"Erro do SE: {e}")
exit()
except Exception as e:
print(f"Erro genérico: {e}")
exit()
Editar o formulário, relacionamentos (selectbox) e anexar arquivos no formulário:
try:
form = {
# chave é o id do campo no banco de dados
# valor é o valor que será atribuido
"pedcompra": "Perdido de compra",
"chave": "2390840923890482093849023849023904809238904",
}
relations = {
# chave é o id do relacionamento
# valor:
# chave é o id do campo da tabela do relacionamento
# valor é o valor que será atribuido
"relmoeda": {
"idmoeda": "DOLAR"
}
}
files = {
# chave é o id do campo no banco de dados
# valor:
# chave é o nome do arquivo
# valor é binário do arquivo (não passar o base64)
"boleto": {
"example.png": open(os.path.join(os.getcwd(), "example.png"), "rb").read()
}
}
api.editEntityRecord(WorkflowID=instancia, EntityID="SOLMIRO", form=form, relationship=relations, files=files)
print(f"Formulário editado com sucesso!")
except SoftExpertException as e:
print(f"Erro do SE: {e}")
exit()
except Exception as e:
print(f"Erro genérico: {e}")
exit()
Adiciona um item em uma grid
try:
MainEntityID = "adte"; # ID da tabela principal
ChildRelationshipID = "relcheck"; # ID do relacionamento da grid
formGrid = {
# chave é o id do campo no banco de dados
# valor é o valor que será atribuido
"atividade": "teste de grid"
}
api.newChildEntityRecord(WorkflowID=instancia, MainEntityID=MainEntityID, ChildRelationshipID=ChildRelationshipID, FormGrid=formGrid)
print(f"Item adicionado à grid com sucesso!")
except SoftExpertException as e:
print(f"Erro do SE: {e}")
exit()
except Exception as e:
print(f"Erro genérico: {e}")
exit()
Anexar arquivo em uma instância (menu de anexo do lado esquerdo):
try:
bin = open(os.path.join(os.getcwd(), "example.png"), "rb").read()
filename = "example.png"
api.newAttachment(WorkflowID=instancia, ActivityID="atvsolicitarmiro", FileName="example.png", FileContent=bin)
print(f"Atividade executada com sucesso!")
except SoftExpertException as e:
print(f"Erro do SE: {e}")
exit()
except Exception as e:
print(f"Erro genérico: {e}")
exit()
Executar atividade:
try:
api.executeActivity(WorkflowID=instancia, ActivityID="atvsolicitarmiro", ActionSequence=1)
print(f"Atividade executada com sucesso!")
except SoftExpertException as e:
print(f"Erro do SE: {e}")
exit()
except Exception as e:
print(f"Erro genérico: {e}")
exit()
Exemplos completos e funcionais no arquivo example.py
Build
Instale as ferramentas de build e upload
pip install build twine
Execute o comando abaixo na raiz do seu projeto para gerar os arquivos de distribuição
python -m build
Enviar pacote
twine upload dist/*
Para buildar de forma automática:
git tag v1.0.1
git push origin v1.0.1
Metadata
Release files for SoftExpertAPI 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| softexpertapi-0.2.0.tar.gz | 7.0 kB | Without provenance | Details for softexpertapi-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| softexpertapi-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for softexpertapi-0.2.0-py3-none-any.whl |
Total release size: 14.1 kB
Release files / softexpertapi-0.2.0.tar.gz
| Download URL | softexpertapi-0.2.0.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4b7d4842d3510b3c0c7bfe3ac85732893f112dcd2546b056bc0a89d4111a69bc
|
|
BLAKE2b-256 checksum How to use checksums |
9f076a7330360fb51e71f4b077900fe6273cabaa0bc3988b53e37efd196558e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.18
|
Release files / softexpertapi-0.2.0-py3-none-any.whl
| Download URL | softexpertapi-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e353df0bffe77320811c1ab97a251e82f537191c885893f0c12ea1290fda658
|
|
BLAKE2b-256 checksum How to use checksums |
8c1bd93b016d81c5d66d589eb14b8c44759f48103b55e8a3763c8f608d0b41cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.18
|
Security for SoftExpertAPI 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.