€cdocutils.nodes document q)q}q(U nametypesq}q(Xsimple flask exampleqNXapiqˆuUsubstitution_defsq}q Uparse_messagesq ]q cdocutils.nodes system_message q )q }q(U rawsourceqUUparentqcdocutils.nodes section q)q}q(hUU referencedqKhhUsourceqX/tmp/pycsw-2.0.2/docs/api.rstqUexpect_referenced_by_nameq}qhcdocutils.nodes target q)q}q(hX.. _api:hhhhUtagnameqUtargetqU attributesq}q(Uidsq ]Ubackrefsq!]Udupnamesq"]Uclassesq#]Unamesq$]Urefidq%Uapiq&uUlineq'KUdocumentq(hUchildrenq)]ubshUsectionq*h}q+(h"]q,Xapiq-ah#]h!]h ]q.(h&Uid1q/eh$]q0hauh'Kh(hUexpect_referenced_by_idq1}q2h&hsh)]q3(cdocutils.nodes title q4)q5}q6(hXAPIq7hhhhhUtitleq8h}q9(h"]h#]h!]h ]h$]uh'Kh(hh)]q:cdocutils.nodes Text q;XAPIq<…q=}q>(hh7hh5ubaubcdocutils.nodes paragraph q?)q@}qA(hXPython applications can integrate pycsw into their custom workflows. This allows for seamless integate within frameworks like Flask and DjangoqBhhhhhU paragraphqCh}qD(h"]h#]h!]h ]h$]uh'Kh(hh)]qEh;XPython applications can integrate pycsw into their custom workflows. This allows for seamless integate within frameworks like Flask and DjangoqF…qG}qH(hhBhh@ubaubh?)qI}qJ(hXeBelow are examples of where using the API (as opposed to the default WSGI/CGI services could be used:qKhhhhhhCh}qL(h"]h#]h!]h ]h$]uh'K h(hh)]qMh;XeBelow are examples of where using the API (as opposed to the default WSGI/CGI services could be used:qN…qO}qP(hhKhhIubaubcdocutils.nodes bullet_list qQ)qR}qS(hUhhhhhU bullet_listqTh}qU(UbulletqVX-h ]h!]h"]h#]h$]uh'K h(hh)]qW(cdocutils.nodes list_item qX)qY}qZ(hX=configuration based on a Python dict, or stored in a databaseq[hhRhhhU list_itemq\h}q](h"]h#]h!]h ]h$]uh'Nh(hh)]q^h?)q_}q`(hh[hhYhhhhCh}qa(h"]h#]h!]h ]h$]uh'K h)]qbh;X=configuration based on a Python dict, or stored in a databaseqc…qd}qe(hh[hh_ubaubaubhX)qf}qg(hX:downstream request environment / framework (Flask, Django)qhhhRhhhh\h}qi(h"]h#]h!]h ]h$]uh'Nh(hh)]qjh?)qk}ql(hhhhhfhhhhCh}qm(h"]h#]h!]h ]h$]uh'K h)]qnh;X:downstream request environment / framework (Flask, Django)qo…qp}qq(hhhhhkubaubaubhX)qr}qs(hX%authentication or authorization logicqthhRhhhh\h}qu(h"]h#]h!]h ]h$]uh'Nh(hh)]qvh?)qw}qx(hhthhrhhhhCh}qy(h"]h#]h!]h ]h$]uh'Kh)]qzh;X%authentication or authorization logicq{…q|}q}(hhthhwubaubaubhX)q~}q(hX&forcing CSW version 2.0.2 as default hhRhhhh\h}q€(h"]h#]h!]h ]h$]uh'Nh(hh)]qh?)q‚}qƒ(hX$forcing CSW version 2.0.2 as defaultq„hh~hhhhCh}q…(h"]h#]h!]h ]h$]uh'Kh)]q†h;X$forcing CSW version 2.0.2 as defaultq‡…qˆ}q‰(hh„hh‚ubaubaubeubh)qŠ}q‹(hUhhhhhh*h}qŒ(h"]h#]h!]h ]qUsimple-flask-exampleqŽah$]qhauh'Kh(hh)]q(h4)q‘}q’(hXSimple Flask Exampleq“hhŠhhhh8h}q”(h"]h#]h!]h ]h$]uh'Kh(hh)]q•h;XSimple Flask Exampleq–…q—}q˜(hh“hh‘ubaubcdocutils.nodes literal_block q™)qš}q›(hX(import logging from flask import Flask, request from pycsw import __version__ as pycsw_version from pycsw.server import Csw LOGGER = logging.getLogger(__name__) APP = Flask(__name__) @APP.route('/csw') def csw_wrapper(): """CSW wrapper""" LOGGER.info('Running pycsw %s', pycsw_version) pycsw_config = some_dict # really comes from somewhere # initialize pycsw # pycsw_config: either a ConfigParser object or a dict of # the pycsw configuration # # env: dict of (HTTP) environment (defaults to os.environ) # # version: defaults to '3.0.0' my_csw = Csw(pycsw_config, request.environ, version='2.0.2') # dispatch the request http_status_code, response = my_csw.dispatch_wsgi() return response, http_status_code, {'Content-type': csw.contenttype}hhŠhhhU literal_blockqœh}q(Ulinenosqž‰UlanguageqŸXpythonU xml:spaceq Upreserveq¡h ]h!]h"]Uhighlight_argsq¢}h#]h$]uh'Kh(hh)]q£h;X(import logging from flask import Flask, request from pycsw import __version__ as pycsw_version from pycsw.server import Csw LOGGER = logging.getLogger(__name__) APP = Flask(__name__) @APP.route('/csw') def csw_wrapper(): """CSW wrapper""" LOGGER.info('Running pycsw %s', pycsw_version) pycsw_config = some_dict # really comes from somewhere # initialize pycsw # pycsw_config: either a ConfigParser object or a dict of # the pycsw configuration # # env: dict of (HTTP) environment (defaults to os.environ) # # version: defaults to '3.0.0' my_csw = Csw(pycsw_config, request.environ, version='2.0.2') # dispatch the request http_status_code, response = my_csw.dispatch_wsgi() return response, http_status_code, {'Content-type': csw.contenttype}q¤…q¥}q¦(hUhhšubaubeubeubhhhUsystem_messageq§h}q¨(h"]UlevelKh ]h!]q©h/aUsourcehh#]h$]UlineKUtypeUINFOqªuh'Kh(hh)]q«h?)q¬}q­(hX&Duplicate implicit target name: "api".h}q®(h"]h#]h!]h ]h$]uhh h)]q¯h;X&Duplicate implicit target name: "api".q°…q±}q²(hUhh¬ubahhCubaubaUcurrent_sourceq³NU decorationq´NUautofootnote_startqµKUnameidsq¶}q·(hhŽhh&uh)]q¸(hhehUU transformerq¹NU footnote_refsqº}q»Urefnamesq¼}q½Usymbol_footnotesq¾]q¿Uautofootnote_refsqÀ]qÁUsymbol_footnote_refsqÂ]qÃU citationsqÄ]qÅh(hU current_lineqÆNUtransform_messagesqÇ]qÈh )qÉ}qÊ(hUh}qË(h"]UlevelKh ]h!]Usourcehh#]h$]UlineKUtypehªuh)]qÌh?)qÍ}qÎ(hUh}qÏ(h"]h#]h!]h ]h$]uhhÉh)]qÐh;X)Hyperlink target "api" is not referenced.qÑ…qÒ}qÓ(hUhhÍubahhCubahh§ubaUreporterqÔNUid_startqÕKU autofootnotesqÖ]q×U citation_refsqØ}qÙUindirect_targetsqÚ]qÛUsettingsqÜ(cdocutils.frontend Values qÝoqÞ}qß(Ufootnote_backlinksqàKUrecord_dependenciesqáNU rfc_base_urlqâUhttps://tools.ietf.org/html/qãU tracebackqäˆUpep_referencesqåNUstrip_commentsqæNU toc_backlinksqçUentryqèU language_codeqéUenqêU datestampqëNU report_levelqìKU _destinationqíNU halt_levelqîKU strip_classesqïNh8NUerror_encoding_error_handlerqðUbackslashreplaceqñUdebugqòNUembed_stylesheetqó‰Uoutput_encoding_error_handlerqôUstrictqõU sectnum_xformqöKUdump_transformsq÷NU docinfo_xformqøKUwarning_streamqùNUpep_file_url_templateqúUpep-%04dqûUexit_status_levelqüKUconfigqýNUstrict_visitorqþNUcloak_email_addressesqÿˆUtrim_footnote_reference_spacer‰UenvrNUdump_pseudo_xmlrNUexpose_internalsrNUsectsubtitle_xformr‰U source_linkrNUrfc_referencesrNUoutput_encodingrUutf-8rU source_urlr NUinput_encodingr U utf-8-sigr U_disable_configr NU id_prefixr UU tab_widthrKUerror_encodingrUUTF-8rU_sourcerhUgettext_compactrˆU generatorrNUdump_internalsrNU smart_quotesr‰U pep_base_urlrU https://www.python.org/dev/peps/rUsyntax_highlightrUlongrUinput_encoding_error_handlerrhõUauto_id_prefixrUidrUdoctitle_xformr‰Ustrip_elements_with_classesrNU _config_filesr]Ufile_insertion_enabledr ˆU raw_enabledr!KU dump_settingsr"NubUsymbol_footnote_startr#KUidsr$}r%(hŽhŠh&hh/huUsubstitution_namesr&}r'hh(h}r((h"]h ]h!]Usourcehh#]h$]uU footnotesr)]r*Urefidsr+}r,h&]r-hasub.