Skip to main content

Esta lib fornece um wrapper às APIs SoftExpert

Project description

SoftExpertAPI

Esta lib fornece um wrapper às APIs SoftExpert

Instanciar a lib:

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()

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()

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

softexpertapi-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

softexpertapi-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: softexpertapi-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for softexpertapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4b5a6ffbd4b1bd02d3759e7952b20a84396aacf6b9887b5d4b8138c72e8b6bfc
MD5 c0cec2d7601bd7442e3985608c91ea85
BLAKE2b-256 5be3fd8f371343ee61ea49069f8604e477e94848d0d554bcf26021d951c87e72

See more details on using hashes here.

File details

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

File metadata

  • Download URL: softexpertapi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for softexpertapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf92dd579d34383c40897dfaca7cb315495635f73c900706fc1744feee4c9505
MD5 93b211c15478f556f1239e63c9e177a7
BLAKE2b-256 4e2d63445d0af40c2dd57546979ca5344f26cd0673e47ec4eff1037e6f5940af

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