zachwill / dom

Check domain name availability from the command line.
214 stars 24 forks source link

not working on linux #23

Open sensay-nelson opened 6 years ago

sensay-nelson commented 6 years ago

Using ubuntu, I'm seeing the following error when doing dom zachwill.com

Traceback (most recent call last):
  File "/usr/local/bin/dom", line 7, in <module>
    Domain().main()
  File "/usr/local/lib/python2.7/dist-packages/domainr/core.py", line 127, in main
    status = self.status(args)
  File "/usr/local/lib/python2.7/dist-packages/domainr/core.py", line 59, in status
    data = Domain.parse_status(json_data.content, env)
  File "/usr/local/lib/python2.7/dist-packages/domainr/core.py", line 79, in parse_status
    status = data['status']
KeyError: 'status'

replacing:

print('\n'.join(status)) 

with:

print(status)

works, but the output is ugly.

b[0m  zachwill.com', u'\x1b[31m\u2717\x1b[0m  zachwill.compare', u'\x1b[32m\u2713\x1b[0m  \x1b[1m\x1b[34mzachwill.community\x1b[0m', u'\x1b[32m\u2713\x1b[0m  \x1b[1m\x1b[34mzachwill.company\x1b[0m', u'\x1b[32m\u2713\x1b[0m  \x1b[1m\x1b[34mzachwill.computer\x1b[0m', u'\x1b[32m\u2713\x1b[0m  \x1b[1m\x1b[34mzachwill.net\x1b[0m', u'\x1b[32m\u2713\x1b[0m  \x1b[1m\x1b[34mzachwill.org\x1b[0m', u'\x1b[32m\u2713\x1b[0m  \x1b[1m\x1b[34mzachwill.us\x1b[0m']

I believe the issue is the syntax highlighting is specific to osx terminal. may want to put that in the docs.

seanlane commented 6 years ago

I've tried using dom with both OSX, Ubuntu, and a variant of Arch Linux, each with Python 2 & 3, and all have worked fine. I ran into some other issues, but nothing related to a KeyError such that 'status' didn't exist within the data object.

If you are familiar with Docker, the following Dockerfile can be used to show a simple testing environment, which the command docker build /path/to/Dockerfile:

FROM ubuntu:16.04

RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get install -y python python-pip

ENV DOMAINR_MASHAPE_KEY={replace with your key as needed}

RUN pip install dom
RUN dom --ascii zachwill

The output I get from this is as expected:

X  z.ac
X  za.ch
X  zachwill.com
A  zachwill.net
A  zachwill.org
A  zachwill.us
bogdanr commented 6 years ago

I also have this issue with both python2 and 3 on Debian 9

Traceback (most recent call last):
  File "/usr/local/bin/dom", line 7, in <module>
    Domain().main()
  File "/usr/local/lib/python3.5/dist-packages/domainr/core.py", line 127, in main
    status = self.status(args)
  File "/usr/local/lib/python3.5/dist-packages/domainr/core.py", line 59, in status
    data = Domain.parse_status(json_data.content, env)
  File "/usr/local/lib/python3.5/dist-packages/domainr/core.py", line 79, in parse_status
    status = data['status']
KeyError: 'status'
seanlane commented 6 years ago

Would you be able to debug the script and print out the value for the data object from line 79? I wonder if there's some error that isn't being caught.

void285 commented 6 years ago

This error may be caused by wrong api key, I solved it by correct my api key.