Skip to content

Instantly share code, notes, and snippets.

@gdemir
Created March 8, 2011 12:48
Show Gist options
  • Select an option

  • Save gdemir/860231 to your computer and use it in GitHub Desktop.

Select an option

Save gdemir/860231 to your computer and use it in GitHub Desktop.
response github user
#!/usr/bin/python
#-*- coding:utf-8 -*-
from urllib2 import *
import os
def error(msj):
print "%s" % (msj)
exit(19)
def ask(default_name):
print "your name ? [ %s ]" % (default_name),
name = raw_input("")
if not name: name = default_name
return name
def response_url(url):
try:
urlopen(url)
except HTTPError, e: # 404
error(e.code)
except URLError, e: # url-error
error(e.args)
print "success"
name = ask(os.path.basename(os.getcwd()))
url = "http://github.com/" + name
response_url(url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment