Pyjasperclient
JasperServer SOAP client for Python
Install / Use
/learn @agaoglu/PyjasperclientREADME
Introduction
A simple python module to run and get generated reports deployed on a JasperServer. Module works by consuming the SOAP web service provided by the JasperServer. It is ideal for python projects that uses JasperServer for reporting and needs a way to access/publish these reports to their users easily. However, this project is not a management interface for JasperServer, you should use its web interface and/or iReport for that.
Requirements
- For 0.2.x python2 and suds (>= 0.3.8 GA) # https://fedorahosted.org/suds/wiki
- For 0.3.x python3 and suds-py3 # https://github.com/cackharot/suds-py3
Usage
For the impatient
from pyjasperclient import JasperClient
url = 'http://localhost:8080/jasperserver/services/repository?wsdl'
jc = JasperClient()
js.login(url, 'jlogin', 'jpass')
report = js.run('/Reports/reporting_to_the_explanatory_note/Report30', 'XLS', {'Year': u'2011'}, {'onePagePerSheet': 'true'})
report_file = file('report.xls','wb')
f.write(report[1]['data'])
f.close()
JasperClient object
Create your Jasper object with JasperServer wsdl url and JasperServer credentials.
j = JasperClient( 'http://localhost:8080/jasperserver/services/repository?wsdl', 'joeuser', 'joeuser')
There are only three methods that can be used.
JasperClient.list(dir="")
Returns a list of strings that are report URIs of the JasperServer. Optional dir param may be used to define the directory to look for. It should start with / and end with directory name. (No / at the end)
JasperClient.get(uri)
Returns a dict with report (uri) parametrs: report:
- name
- id (uriString)
- label
- description
- controls [list]:
- id (inputControl uri)
- name
- type
- label
- description
- parameters [list]:
- name
- class
- default (default value)
Jasper.run(uri, output="PDF", params={}, args={})
This will run the report for the URI given in uri and generate a dict containing 'content-type' and 'data'. 'content-type' can be used to send as an HTTP response header. params is a simple dict to pass directly to the running report. Uri should be report URI on JasperServer. Output may be PDF, JRPRINT, HTML, XLS, XML, CSV and RTF; default PDF
Check the source for more info
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
