• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(1954)  |  Call(1693)  |  Derive(0)  |  Import(261)
gethostname() -> string

Return the current host name.

src/p/y/python-cookbook-HEAD/cb2_examples/cb2_15_3_sol_2.py   python-cookbook(Download)
# xmlrpc_client.py
from socket import gethostname
from xmlrpclib import Transport, dumps
class xmlrpc_connection(object):
    def __init__(self, host=None, port=8182):
        if host is None:
            host = gethostname()

src/p/y/python-cookbook-HEAD/cb2_examples/cb2_15_3_sol_1.py   python-cookbook(Download)
# xmlrpc_server.py
from socket import gethostname
from medusa.xmlrpc_handler import xmlrpc_handler
from medusa.http_server import http_server
from medusa import asyncore
class xmlrpc_server(xmlrpc_handler):
    # initialize and run the server
    def __init__(self, host=None, port=8182):
        if host is None:
            host = gethostname()

src/p/s/psp_samples-HEAD/psplibs-pygame_mockup/pspnet.py   psp_samples(Download)
#!/usr/bin/python
""" Wrapper for PyGame, which exports the pspnet API on non-PSP systems. """
 
__author__ = 'Boris Buegling, <boris@icculus.org>'
import time, thread
from socket import gethostbyname, gethostname
 
def getIP():
  return gethostbyname(gethostname())
 
if __name__ == '__main__':
  print getIP()
 
def enumConfigs():

src/c/i/circuits-1.2.1/examples/telnet.py   circuits(Download)
 
import os
import optparse
from socket import gethostname
 
from circuits.io import stdin
from circuits import handler, Component
    def __init__(self, *args):
        super(Telnet, self).__init__()
 
        if len(args) == 1:
            if os.path.exists(args[0]):
                self += UNIXClient(channel=self.channel)
                host = gethostname()

src/c/i/circuits-1.2.1/examples/ircclient.py   circuits(Download)
 
import os
import optparse
from socket import gethostname
 
from circuits.io import stdin
from circuits import handler, Component
    def __init__(self, opts, host, port=6667):
        super(Client, self).__init__()
 
        self.opts = opts
        self.host = host
        self.port = port
        self.hostname = gethostname()

src/c/i/circuits-1.2.1/circuits/net/sockets.py   circuits(Download)
from errno import *
from _socket import socket as SocketType
from collections import defaultdict, deque
from socket import gethostname, gethostbyname
 
from circuits.net.pollers import Select as DefaultPoller
from circuits.core import handler, Event, Component
    def __init__(self, bind=None, channel=channel, **kwargs):
        super(Client, self).__init__(channel=channel, **kwargs)
 
        if type(bind) is int:
            self.bind = (gethostbyname(gethostname()), bind)
        elif type(bind) is str and ":" in bind:
            host, port = bind.split(":")
        if self.ssl:
            self._sslsock = socket.ssl(self._sock)
 
        self.push(Connected(gethostname(), path), "connected", self.channel)
 
 
class Server(Component):
    def __init__(self, bind, ssl=False, channel=channel, **kwargs):
        super(Server, self).__init__(channel=channel)
 
        if type(bind) is int:
            self.bind = (gethostbyname(gethostname()), bind)
        elif type(bind) is str and ":" in bind:
            host, port = bind.split(":")

src/b/t/btqueue-HEAD/trunk/btqueue/BitQueue/launchmanycore_bittorrent.py   btqueue(Download)
from BitTorrent.zurllib import quote
from binascii import b2a_hex
from random import random, randrange
from socket import error, gethostbyname, gethostname
from BitTorrent.platform import bttime
from BitTorrent.btformats import check_peers
from urllib2 import Request,urlopen
    def _makeurl(self, peerid, port):
        url = ('info_hash=%s&peer_id=%s&port=%s&key=%s' %
                (quote(self.infohash), quote(peerid), str(port),
                 b2a_hex(''.join([chr(randrange(256)) for i in xrange(4)]))))
        try:
            url += '&local_ip=%s' % quote(gethostbyname(gethostname()))
        except:

src/b/t/btqueue-HEAD/btqueue/BitQueue/launchmanycore_bittorrent.py   btqueue(Download)
from BitTorrent.zurllib import quote
from binascii import b2a_hex
from random import random, randrange
from socket import error, gethostbyname, gethostname
from BitTorrent.platform import bttime
from BitTorrent.btformats import check_peers
from urllib2 import Request,urlopen
    def _makeurl(self, peerid, port):
        url = ('info_hash=%s&peer_id=%s&port=%s&key=%s' %
                (quote(self.infohash), quote(peerid), str(port),
                 b2a_hex(''.join([chr(randrange(256)) for i in xrange(4)]))))
        try:
            url += '&local_ip=%s' % quote(gethostbyname(gethostname()))
        except:

src/b/t/btqueue-HEAD/trunk/btqueue/BitTornado/BT1/Rerequester.py   btqueue(Download)
from threading import Thread, Lock
from cStringIO import StringIO
from traceback import print_exc
from socket import error, gethostbyname, gethostname
from random import shuffle
from sha import sha
from time import time
        self.url = ('?peer_id=%s&info_hash=%s&port=%s' %
            (quote(myid), quote(infohash), str(port)))
        try:
            self.url += '&local_ip=%s' % gethostbyname(gethostname())
        except:
            pass
        self.ip = ip

src/b/t/btqueue-HEAD/btqueue/BitTornado/BT1/Rerequester.py   btqueue(Download)
from threading import Thread, Lock
from cStringIO import StringIO
from traceback import print_exc
from socket import error, gethostbyname, gethostname
from random import shuffle
from sha import sha
from time import time
        self.url = ('?peer_id=%s&info_hash=%s&port=%s' %
            (quote(myid), quote(infohash), str(port)))
        try:
            self.url += '&local_ip=%s' % gethostbyname(gethostname())
        except:
            pass
        self.ip = ip

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next