Created
March 8, 2011 12:48
-
-
Save gdemir/860231 to your computer and use it in GitHub Desktop.
response github user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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