Python GET REMOTE SERVER'S INFO

 1 #!/usr/bin/env python
 2 #--*-- coding:utf-8 --*--
 3 # Python Network Programming Cookbook -- Chapter – 1
 4 # This program is optimized for Python 2.7.
 5 # It may run on any other version with/without modifications.
 6 import socket
 7 def get_remote_machine_info():
 8     remote_host = ‘www.python.org‘
 9     try:
10         print "IP address: %s" %socket.gethostbyname(remote_host)
11     except socket.error, err_msg:
12         print "%s: %s" %(remote_host, err_msg)
13
14 if __name__ == ‘__main__‘:
15     get_remote_machine_info()

TEST:

IP address: 23.235.43.223
[Finished in 0.1s]

Python GET REMOTE SERVER'S INFO

时间: 2024-11-05 14:44:27

Python GET REMOTE SERVER'S INFO的相关文章

selenium Remote Server 实现原理

selenium作为一个出色的web automation框架,被越来越多的企业采用究其原因,框架设计的比较remarkable, 作为一个开源的框架,能够开辟出一套协议,以至于针对app测试的appium采取相同的strategy.使用的是webdriver protocol的扩展版. 为什么说这个框架设计的比较好?究竟好在哪里? 先从表面上看: selenium automation framework 支持多语言,java.python.c#.JavaScript.Perl.ruby ..

SQL Agent Job 报“Access to the remote server is denied because the current security context is not trusted”

SQL Server 2005(Microsoft SQL Server 2005 - 9.00.5000.00)下的一个作业执行一个存储过程,存储过程中动态SQL语句使用链接服务器(Linked Servers),从另外一台SQL Server服务器获取数据.但是执行时报"Access to the remote server is denied because the current security context is not trusted".但是在SSMS客户端手工执行存储

写Storage Table时报The remote server returned an error: (409) Conflict.

今天在往 Azure Storage Table中写入一条记录时,在刚开始老报 The remote server returned an error: (409) Conflict. 的异常,过了一阵子又好了.百思不得其解,后来终于在MSDN中找到了一段解释: When a table is successfully deleted, it is immediately marked for deletion and is no longer accessible to clients. Th

System.Net.WebException : The remote server returned an error: (415) UNSUPPORTED MEDIA TYPE

I am having problems with a bit of code that accesses a restful web service. Running this code, it errors out at var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); and the exception returned is: "System.Net.WebException : The remote se

解决selemium报错 Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure

关于 Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 代码中少了 webdriver.chrome.driver", "

python 连接sql server

python 连接sql server的例子: import pymssql conn = pymssql.connect(host='SQL01', user='user', password='password', database='mydatabase') cur = conn.cursor() cur.execute('CREATE TABLE persons(id INT, name VARCHAR(100))') cur.executemany("INSERT INTO perso

Jmeter-Maven-Plugin高级应用:Remote Server Configuration

Remote Server Configuration Pages 12 Home Adding additional libraries to the classpath Advanced Configuration Basic Configuration Configuring the jvm that the jmeter process runs in FAQ Log Levels Modifying Properties Proxy Configuration Remote Serve

WebService:The remote server returned an error: (400) Bad Request

开发工具:VS2010.开发组件:WebService.运行环境:Windows 今天一个同事在进行计费接口联调试时,发现了一个非常奇怪的问题:接口在家里环境测试,一切正常,但是部署到现网环境之后,连续调用几次接口就会出现错误:The remote server returned an error: (400) Bad Request,然后回收一下WebService自己的程序池,再调用又可以了,再连续调用几次,又出现了上面的问题. 他来找我帮忙查问题,在了解整个过程之后,我就直接根据经验,设置

Request Connection: Remote Server @ 192.229.145.200:80

录制Loadrunner脚本时,提示: Request Connection: Remote Server @ 192.229.145.200:80   NOT INTERCEPTED!(REASON: User requested to IGNORE connection): 解决方法: 1. 打开IE里的Internet选项,单击连接选项卡.单击最下面的局域网设置,自动配置栏里的自动检测设置选项不要勾选. 2.打开Virtual User Generator.在Record栏里面打开Reco