Added the ability to register domains from CLI #6

Closed
wants to merge 8 commits into from

3 participants

@connor

I love the domai.nr CLI, but sometimes I wish I could register them from it, too.

So, I made this so you can (kind of). I'm utilizing the webbrowser module, and just seeing if the user's first parameter is register. If It is, then I open up a new tab with the URL set as the registration URL for that domain.

Not the best code quality, but gets the job done ;)

Connor Montg... added some commits Apr 15, 2012
@talsafran
Owner

Awesome dude, thanks! I have a suggestion for a nicer interface.

WIth the original CLI, I like not having to pass in an actual address but a phrase. That's the fun part about domainr. I wonder if we can change the results of the domainr command to have numbered results for available domains.

  $ domainr talsafran
    Looking up domains for talsafran...
        talsafran.com - taken
        talsafran.net - available [1]
        talsafran.org - available [2]
        talsafr.an - available     [3]
        talsa.fr - available         [4]
        tals.af - available          [etc I am lazy :)]
        tal.sa - available
        ta.ls - unavailable
        tls.fr - taken
        t.al - unavailable
        t.ls - unavailable
        tl - tld

After each run, write those results to a file.

Then do something like domainr register 3 and it'll try to register talsafr.an. What do you think?

I can hack on it this weekend but you're more than welcome to give it a crack first! :)

@connor

I'm totally down for this. Busy until tomorrow night, but should have some time :D

@talsafran
Owner

No presh, whenever you feel like it

@case

Thanks for working on this, gents — lemme know when it's committed and we'll mention on @domainr.

Cheers!
-Eric

@connor

Yep - not a problem fellas! Got it about 95% there - just need to log multiple arguments, ex:

$ domainr connormontgomery talsafran case

Working great for single domains passed in, though.

Connor Montg... added some commits Apr 20, 2012
Connor Montgomery better register workflow c5791a9
Connor Montgomery added example to readme 9650e04
@connor

Alright - there we go fellas. Should be pretty solid. I have tested it with several domains, and it's working great. Code quality isn't the best - I tried using descriptive variable names. Take a look and if it doesn't make sense to you, let me know!

@talsafran
Owner

Couldn't get this to work. :(

tal:~/Projects/connor/domainr $ ./domainr talsafran
Looking up domains for talsafran...
    talsafran.com - taken
    talsafran.net - available [1]
    talsafran.org - available [2]
    talsafr.an - unavailable
    talsa.fr/an - available [3]
    tals.af/ran - available [4]
    tal.sa/fran - available [5]
    tls.fr/n - taken
    ta.ls/afran - unavailable
    t.al/safran - unavailable
    t.ls/frn - unavailable
    tl/sfrn - tld
tal:~/Projects/connor/domainr $ ./domainr register 1
Traceback (most recent call last):
  File "./domainr", line 169, in <module>
    main(argv[1:])
  File "./domainr", line 84, in main
    available_domain_data = ast.literal_eval("%s" % external_available_domains )
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/ast.py", line 49, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    {1: u'talsafran.net', 2: u'talsafran.org', 3: u'talsa.fr', 4: u'tals.af', 5: u'tal.sa'
                                                                                         ^
SyntaxError: unexpected EOF while parsing

Also... spacing should be more consistent... need to appease the Python gods..

@connor

hmm interesting. was working fine for me, but I'll dig into it.

re: spacing - super apologies dude. will fix that up.

@connor

@talsafran fixed it up - I accidentally removed a line that added the closing } to the JSON that is stored. That's fixed, now just gotta get the white space all cleaned up.

Connor Montgomery now it's working. other notes:
-  made it 4 spaces per tab instead of 2.
- if second argument is 'register', and there is no number to register, it'll search for domains using 'register', like it should.
76684e9
@connor

Don't pull this in yet. I was testing it and just found out it works only with 1 domain searches. Really sorry for this messy PR - i may just open up a clean new one when it's 100% done.

my bad dude.

Connor Montg... added some commits Apr 23, 2012
@connor connor closed this Apr 23, 2012
@connor

Closing to make it an easy PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment