Only uses modules included in AciveState basic install. Created as a function that can be imported or run.
Forked Gist from:
- fork using Hurl.it
- https://gist.github.com/eteq/1750715
- http://stackoverflow.com/a/11621536
See:
Only uses modules included in AciveState basic install. Created as a function that can be imported or run.
Forked Gist from:
See:
# from http://stackoverflow.com/questions/10367859/github-api-giving-404-when-passing-json-data-with-python-urllib2 | |
import urllib2 | |
import json | |
import getpass | |
import base64 | |
# Generate a token from the username and password. | |
# NOTE: this is a naive implementation. Store pre-retrieved tokens if possible. | |
username = 'pelson' |
''' | |
Simple socket server using threads | |
''' | |
import socket | |
import sys | |
from thread import * | |
HOST = '' # Symbolic name meaning all available interfaces | |
PORT = 8000 # Arbitrary non-privileged port |
# from https://gist.github.com/auwsome/7815c3b220de0faf5694 | |
# This code is modified from code by Stephen C Phillips at http://scphillips.com would be nice. | |
html1 = """HTTP/1.0 200 OK | |
Content-Type: text/html | |
<html> | |
<head> |
import os, urllib2 | |
realcwd = os.path.dirname(os.path.realpath(__file__)) | |
url1 = 'http://raw.githubusercontent.com/auwsome/pybot/master/Pybot.py' | |
#urls[1] = 'http://raw.githubusercontent.com/auwsome/pybot/master/sendPybot.py' | |
#for url in urls[url]: | |
req = urllib2.Request(url1) | |
response = urllib2.urlopen(req) |