我如何使用python脚本或将其转换为与c#一起使用? [英] how can i use a python script or convert it to use with c#?

查看:152
本文介绍了我如何使用python脚本或将其转换为与c#一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生您好,
我有一个依赖brodband连接,我正在寻找一种拨号器,该拨号器可以自动登录以依赖,也可以在特定时间自动注销.我找到了要登录才能依靠的脚本,但是我必须对其进行自定义才能完成任务.您能指导我如何在C#应用程序中使用此脚本或将其转换为C#或执行此操作的任何方法.这是我找到的python脚本.

hello sir,
i have a reliance brodband connection and i was looking for a dialer that auto login to reliance and also auto logout on specific time. i found a script to login to reliance but i had to customize it to get my task done. can you guide me how can i use this script with a c# app or convert it to c# or anything that does this. here is the python script i found.

Reliance Login Script for Python 3.0 v1.0
 
Created by Kunal Dua on 2009-12-30
http://www.kunaldua.com/blog/?p=323
 
This program is free software; you may redistribute it and/or
modify it under the same terms as Python itself.
"""
 
import urllib, http.cookiejar
 
username = '1111111111111111' #replace the text within quotes with your username
password = 'password'	#replace the text within quotes with your password
 
jar = http.cookiejar.FileCookieJar("cookies")
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(jar))
 
response = opener.open("http://10.239.89.15/reliance/startportal_isg.do")
 
login_data = urllib.parse.urlencode({'userId' : username, 'password' : password, 'action' : 'doLoginSubmit'})
resp = opener.open('http://10.239.89.15/reliance/login.do', login_data)

推荐答案

您好,您可以使用IronPython在.NET中运行python脚本.

http://ironpython.codeplex.com/ [ ^ ]
Hi, You can use IronPython to run python scripts in .NET.

http://ironpython.codeplex.com/[^]


这篇关于我如何使用python脚本或将其转换为与c#一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆