Skip to content
J. Seth Strattan edited this page Oct 29, 2013 · 16 revisions
usage: one_ENCODE.py [-h] [--infile INFILE] [--server SERVER] [--key KEY]
                     [--keyfile KEYFILE] [--authid AUTHID] [--authpw AUTHPW]
                     [--force-put] [--get-only] [--id ID] [--debug]

POST, PATCH or PUT one ENCODE JSON object

optional arguments:
  -h, --help            show this help message and exit
  --infile INFILE, -i INFILE
                        File containing the JSON object as a JSON string.
  --server SERVER       Full URL of the server.
  --key KEY             The keypair identifier from the keyfile. Default is
                        --key=default
  --keyfile KEYFILE     The keypair file. Default is --keyfile=./keypairs.json
  --authid AUTHID       The HTTP auth ID.
  --authpw AUTHPW       The HTTP auth PW.
  --force-put           Force the object to be PUT rather than PATCHed.
                        Default is False.
  --get-only            Do nothing but get the object and print it. Default is
                        False.
  --id ID               URI for an object
  --debug               Print debug messages. Default is False.

 Script to add one ENCODE object from a file or stdin

Prerequisites

  • keyfile exemplified in keypairs.json
  • import requests, json

Examples

$ one_ENCODE.py --id ENCBS999JSS

GET the specified object from the default server using the default keypair; pretty-print as a JSON string; flatten embedded objects into references.

Clone this wiki locally