Splunk AppDynamics

Want to login to Peoplesoft through Python?

CommunityUser
Splunk Employee
Splunk Employee

Hello,

Here's some code that uses the wonderful Requests python library to login and logout of Peoplesoft. I used this to automate a series of iscript calls.

import requests

def PSlogin(baseURL, userid, pwd, lang='ITA'):
    params = {'cmd' : 'login', 'languageCd' : lang}
    payload = {'userid' : userid, 'pwd' : pwd, 'timezoneOffset' : '-60'}
    r = requests.post(baseURL, params=params, data=payload, allow_redirects=False)
    return r.cookies

def PSLogout(baseURL, cookies):
    params = {'cmd' : 'logout'}
    r =requests.post(baseURL, params=params, cookies=cookies) 



where baseURL is something like http://mypeoplesoftURL.com/psc/ps/EMPLOYEE/HRMS/.

PSlogin will log into Peoplesoft and return the login cookies. To make requests after calling PSlogin, you have to set the cookies for the request with the ones you got from PSlogin. 

Suppose we have a weblib function like this:

Function IScript_Hello()
   Local string &Test = %Request.GetParameter("test");
   %Response.Write("Hello " | &
Test);
End-Function;


a sample Python function that calls the IScript_Hello function inside the weblib WEBLIB_HELLO will be like this:

def getTestResult(baseURL, cookies, test):
    sqlURL =  baseURL + 's/WEBLIB_HELLO.FUNCLIB.FieldFormula.IScript_Hello'
    payload = {'
test' : test}
    r = requests.post(sqlURL, cookies=cookies, data=payload)
    return r.text


and we can call getTestResult like this:


baseURL = http://mypeoplesoftURL.com/psc/ps/EMPLOYEE/HRMS/
login_cookies = PSlogin(baseURL,'PS', 'PS')
try:
    res = getTestResult(baseURL, login_cookies, 'Andrea')
finally:
    PSLogout(baseURL, login_cookies)

Credits: apsource

Labels (1)
0 Karma

Sajna_Sreenivas
Path Finder

Hi Madison,

Could you please elaborate on what details you need from AppDynamics on the same.Do you need some help

in instrumenting any Python application?

Here are some details on how to do it in case you are looking for the same

https://docs.appdynamics.com/display/PRO43/Python+Agent

Thanks,

Sajna

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...