tests.cgi-bin.fgcp_relay
index
fgcp_relay.py

This is a really basic CGI script that allows you to test the relay feature
via a CGI webserver, e.g. by specifying the following region in your scripts:
 
    region='relay=http://localhost:8000/cgi-bin/fgcp_relay.py'
 
In order to use this CGI script for relay testing, you need to adapt the lines
    pem_file = '../client.pem'
    region = 'de'
at the bottom of this script, and specify your own certificate and
region there

 
Modules
       
cgi
os
sys

 
Classes
       
FGCPRelayCGIScript

 
class FGCPRelayCGIScript
     Methods defined here:
__init__(self, key_file, region, environ={'FSCDRIVE': 'S:', 'TMP': 'C:\\TEMP', 'COMPUTERN...s\\Public', 'USERPROFILE': 'C:\\Users\\BRUMDall'}, fpin=<open file '<stdin>', mode 'r' at 0x0158D020>, fpout=<open file '<stdout>', mode 'w' at 0x0158D068>, fperr=<open file '<stderr>', mode 'w' at 0x0158D0B0>)
Initialize variables, environment and filepointers for CGI script
get_body(self, fpin=<open file '<stdin>', mode 'r' at 0x0158D020>)
Get request body
get_header(self, name, default=None)
Get a particular header or return default
get_headers(self, environ={'FSCDRIVE': 'S:', 'TMP': 'C:\\TEMP', 'COMPUTERN...s\\Public', 'USERPROFILE': 'C:\\Users\\BRUMDall'})
Get request headers
get_host(self, region)
Get host for this region
raise_error(self, text='Unknown')
Write error message with traceback and exit CGI script
run(self)
Relay the request to the API server and send back the response
set_environ(self, environ={'FSCDRIVE': 'S:', 'TMP': 'C:\\TEMP', 'COMPUTERN...s\\Public', 'USERPROFILE': 'C:\\Users\\BRUMDall'})
Set environment variables
set_fp(self, fpin=<open file '<stdin>', mode 'r' at 0x0158D020>, fpout=<open file '<stdout>', mode 'w' at 0x0158D068>, fperr=<open file '<stderr>', mode 'w' at 0x0158D0B0>)
Set filepointers for input and output
write_output(self, content_type='text/plain', data='Unknown', fpout=<open file '<stdout>', mode 'w' at 0x0158D068>)
Write Content-type and data

Data and other attributes defined here:
body = None
environ = None
fpin = None
fpout = None
headers = None
host = None
key_file = None
method = None
region = None
uri = '/ovissapi/endpoint'

 
Data
        FGCP_REGIONS = {'au': 'api.globalcloud.fujitsu.com.au', 'de': 'api.globalcloud.de.fujitsu.com', 'jp': 'api.oviss.jp.fujitsu.com', 'sg': 'api.globalcloud.sg.fujitsu.com', 'uk': 'api.globalcloud.uk.fujitsu.com', 'us': 'api.globalcloud.us.fujitsu.com'}