Package: pfurl
Table of ContentsOverviewpfurlInstallationPython Virtual EnvironmentUsing thefnndsc/pfurlcontainerUsageExamplesOverviewThis repository provides a curl-like client tool that is also able to perform simple file/directory functions (such as zip/unzip) suitable for remote http transmission:pfurl: a tool to transfer data using HTTP (similar tocurl);pfurlpfurlis part of thepffamily of utilities, and used as components of the ChRIS Research Integration System.In the simplest sense,pfurlis a wrapper aboutpycurl, used to send http-based messages to remote services (typicallypmanandpfioh). In addition to curl-type http communication,pfurlalso provides some basic file-system services: the ability to zip directories and transmit this to a remote service.Various authentication options for verifying identify with the remote service are also available.InstallationInstallation is relatively straightforward, and we recommend using either python virtual environments or docker.Python Virtual EnvironmentOn Ubuntu, install the Python virtual environment creatorsudoaptinstallvirtualenvvirtualenvwrapperpython3-tkThen, create a directory for your virtual environments e.g.:mkdir~/python-envsYou might want to add to your .bashrc file these two lines:exportWORKON_HOME=~/python-envssource/usr/local/bin/virtualenvwrapper.shThen you can source your .bashrc and create a new Python3 virtual environment:source.bashrcmkvirtualenv--python=python3chris_envTo activate or “enter” the virtual env:workonpython_envTo deactivate virtual env:deactivateUsing thefnndsc/pfurlcontainerThe easiest option however, is to just use thefnndsc/pfurlcontainer image.dockerpullfnndsc/pfurland then rundockerrun--rm--namepfurlfnndsc/pfurl\--VERBPOST--raw\--httplocalhost:5055/api/v1/cmd\--httpResponseBodyParse--msg'
           {
                "someJSONmessage": "Whatever"
           }
           'where themsgcontains JSON syntax instructions of what to perform.UsageFor the most up-to-date usage ofpfurl, consult thepfurl wiki page.ARGS

    [--verb<RESTVERB>]
    The REST verb to use for the remote service.

    [--http<IP>:<port>]
    The address of the remote service.

    [--httpProxy [<proto>://]<IP>[:<port>]]
    If specified, instruct ``pfurl`` to use the proxy as specified.
    Currently, only 'http' is supported. Valid values for this flag
    include, for example:

        --httProxy http://proxy.host.org:1234

        --httpProxy proxy.host.org:1234

    [--jsonwrapper<outerMsgJSONwrapper>]
    An optional outer wrapper for the JSON payload.

    [--quiet]
    If specified, only echo the final JSON payload returned
    from remote server.

    [--raw]
    If specified, do not wrap return data from remote call in a
    JSON wrapper.

    [--oneShot]
    If specified, transmit a shutdown control sequence to remote server
    after communicating. This of course only works for services that
    understand the shutdown protocol.

    [--man<help>]
    Provide detailed help on various topics.

    [-x|--desc]
    Provide an overview help page.

    [-y|--synopsis]
    Provide a synopsis help summary.

    [--content-type<type>]
    Curl content-type descriptor.

    [--jsonpprintindent<indent>]
    If specified, print return JSON payload from remote service using<indent>indentation.

    [--unverifiedCerts]
    If specified, allows transmission of https requests with self signed SSL
    certificates.

    [--authToken<token>]
    A token to transmit with an http request. Note, you if you set an
    --authToken, then you should NOT also set an --auth.

    [--auth<user>:<passwd>]
    A user name and password authentication string.

    [--version]
    Print internal version number and exit.

    [-v|--verbosity<level>]
    Set the verbosity level. "0" typically means no/minimal output. Allows for
    more fine tuned output control as opposed to '--quiet' that effectively
    silences everything.

    --msg<JSONpayload>The actual JSON formatted payload to transmit to remote service.ExamplesSay ‘hello’ to apfconservice listening on the localhost at port 5005:pfurl\\--verbPOST--raw\\--http127.0.0.1:5005/api/v1/cmd\\--jsonwrapper'payload'\\--msg\\'{  "action": "hello",
                "meta": {
                        "askAbout":     "sysinfo",
                        "echoBack":     "Hi there!"
                }
        }'--quiet--jsonpprintindent4and print response “prettily” using an indent of 4.