Created
April 23, 2012 14:45
-
-
Save DinisCruz/2471374 to your computer and use it in GitHub Desktop.
TeamMentor python - Initial Python Web service call data (by arvinddoraiswamy)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import suds | |
import re | |
url='http://.....:8000//aspx_pages/TM_WebServices.asmx?WSDL' | |
def main(): | |
client=connect_and_login(url) | |
get_methods_parameters_datatypes(client) | |
def connect_and_login(url): | |
client = suds.client.Client(url) | |
client.service.Login('admin','..........') | |
match = re.search(r'ASP.NET_SessionId=.*Cookie Session=', str(client.options.transport.cookiejar)) | |
if match: | |
user_properties=client.service.Current_User() | |
client.set_options(headers={'CSRF_Token': user_properties['CSRF_Token']}) | |
return client | |
def get_methods_parameters_datatypes(client): | |
t1=re.findall(r'.*Methods\ \(\d+\)(.*)Types\ \(\d+\)',str(client),re.DOTALL) | |
main() | |
#d = dict(http='127.0.0.1:8080') | |
#client.set_options(proxy=d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment