Paste P6561

(An Untitled Masterwork)
ActivePublic

Authored by chasemp on Jan 8 2018, 7:03 PM.
tools.admin@tools-bastion-03:~$ kubectl describe pod admin-3517833506-69bqz
Name: admin-3517833506-69bqz
Namespace: admin
Node: tools-worker-1026.tools.eqiad.wmflabs/10.68.22.168
---
No events.tools.admin@tools-bastion-03:~$ kubectl exec -it admin-3517833506-69bqz -- /bin/bash
import urllib2
>>> for i in xrange(1, 10):
... response = urllib2.urlopen("http://google.com", timeout = 5)
... content = response.read()
... print content[:100]
chasemp created this paste.EditedJan 8 2018, 7:03 PM
import socket
import urllib2
import time

def rurl(count=10, sleep=1, url="http://google.com", cutoff=100):
    print "Fetch {} {} times at {} interval".format(url, count, sleep)
    for i in xrange(1, count+1):
        response = urllib2.urlopen(url, timeout = 5)
        content = response.read()
        print "{} {}".format(i, content[:cutoff])
        time.sleep(sleep)

def extip():
    rurl(url='http://icanhazip.com/',
         count=1,
         cutoff=1000)

def resolve(hostname):
    print socket.gethostbyname(hostname)

def resolve_test():
    domains = [
        'yahoo.com',
        'google.com',
        'mediawiki.org',
        'weather.com',
        'npr.com',
        'wmflabs.org',
    ]
    for d in domains:
        print d, resolve(d)