postman-code-generators icon indicating copy to clipboard operation
postman-code-generators copied to clipboard

Please allow manual editing and saving to published docs (and avoid code gen from overwriting it)

Open AustEcon opened this issue 5 years ago • 1 comments

Describe the bug I am interested in the python code generator. I would like to edit the code snippet manually myself and totally disable any interference by the auto code generator (that keeps overriding what I have manually copy-pasted in). If there is a way that this can be done, then I would be very keen to know. Thanks

To Reproduce Body has this raw json:

{
    "outputs": [
        {
            "value": 0,
            "script_pubkey": "6a0548656c6c6f"
        },
        {
            "value": 100,
            "script_pubkey": "76a914fc746b833ca84043e0c7d606de8ecc4b7f3b7cd688ac"
        }
    ],
    "password": "test",
    "utxo_preselection": true
}

Expected code snippet and corresponding request I want it to look something like this:

import requests

url = "http://127.0.0.1:9999/v1/stn/dapp/wallets/my_wallet.sqlite/1/txs/create_and_broadcast"

payload = { "outputs": [{"value": 0,
                         "script_pubkey": "6a0548656c6c6f"},
                        {"value": 100,
                         "script_pubkey": "76a914fc746b833ca84043e0c7d606de8ecc4b7f3b7cd688ac"}],
            "password": "test",
            "utxo_preselection": True}

headers = {'Content-Type': 'application/json'}

response = requests.request("POST", url, headers=headers, json=payload)

print(response.text.encode('utf8'))

Screenshots Instead, it looks like this:

import requests

url = "http://127.0.0.1:9999/v1/stn/dapp/wallets/my_wallet.sqlite/1/txs/create_and_broadcast"

payload = "{\n    \"outputs\": [\n        {\n            \"value\": 0,\n            \"script_pubkey\": \"6a0548656c6c6f\"\n        },\n        {\n            \"value\": 100,\n            \"script_pubkey\": \"76a914fc746b833ca84043e0c7d606de8ecc4b7f3b7cd688ac\"\n        }\n    ],\n    \"password\": \"test\",\n    \"utxo_preselection\": true\n}"
headers = {
'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data = payload)

print(response.text.encode('utf8'))

AustEcon avatar Jan 29 '20 07:01 AustEcon

@webholik Something related to multiline we could take up and provide an option if required. Could you take a look?

umeshp7 avatar Oct 21 '20 09:10 umeshp7