Quantcast
Channel: Active questions tagged servlets - Stack Overflow
Viewing all articles
Browse latest Browse all 675

Python: ServiceDesk PLus Servlet API

$
0
0

I am new to programming in Python and am writing a script for my company. We use ServiceDesk Plus which uses Servlet API. I want to write a script that will auto create/close tickets upon alarms from Solarwinds.

I cannot figure out the syntax for auto creating a ticket using the servlet API in python. Here is what I have (that does not work):

url = 'http://localhost:6970/servlets/RequestServlet/'params = urllib.urlencode({'operation': 'AddRequest',})response = urllib2.urlopen(url, params).read()

Any help would be very appreciated.

EDIT:

I tried what James recommended with no luck. here is what my script looks like using that advice.

import urllibimport urllib2url = 'http://localhost:6970/servlets/RequestServlet/'params = urllib.urlencode({'operation': 'AddRequest','username': 'myuser','password': 'mypassword','requester': 'Bob Smith','subject': 'Test Script Req','description': 'TESTING!!!!!!',    })request = urllib2.Request('http://localhost:6970/servlets/RequestServlet/' ,params)response = urllib2.urlopen(request) 

The errors:

C:\Users\xxx\Desktop>python helpdesk2.pyTraceback (most recent call last):  File "helpdesk2.py", line 24, in <module>    response = urllib2.urlopen(request)  File "C:\Python27\lib\urllib2.py", line 126, in urlopen    return _opener.open(url, data, timeout)  File "C:\Python27\lib\urllib2.py", line 400, in open    response = meth(req, response)  File "C:\Python27\lib\urllib2.py", line 513, in http_response'http', request, response, code, msg, hdrs)  File "C:\Python27\lib\urllib2.py", line 438, in error    return self._call_chain(*args)  File "C:\Python27\lib\urllib2.py", line 372, in _call_chain    result = func(*args)  File "C:\Python27\lib\urllib2.py", line 521, in http_error_default    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)urllib2.HTTPError: HTTP Error 404: /servlets/RequestServlet/

Viewing all articles
Browse latest Browse all 675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>