mojodna / oauth-proxy

(in-use) An HTTP proxy for signing OAuth requests
BSD 3-Clause "New" or "Revised" License
142 stars 15 forks source link

Unknown command: oauth_proxy #4

Closed garyhodgson closed 11 years ago

garyhodgson commented 11 years ago

Hi,

When I try and run the oauth-proxy command I get the following error: /usr/local/bin/twistd: Unknown command: oauth_proxy

I have tried this on Windows and Linux, both throw this error.

Python 2.7, and pip freeze shows: Twisted==13.0.0 Twisted-Core==11.1.0 Twisted-Web==11.1.0 zope.interface==3.6.1

Cheers, Gary

mojodna commented 11 years ago

Confirmed on Ubuntu 12.04:

sudo apt-get install -y python-pip python-dev
sudo pip install oauth-proxy
oauth-proxy
...
/usr/local/bin/twistd: Unknown command: oauth_proxy

Unfortunately, my grasp on how Twisted finds applications was never very strong and has diminished since I last fought with it. Setting the PYTHONPATH to /usr/local/lib/... doesn't work. Providing a .tap tile might do the trick... Or figuring out why https://github.com/mojodna/oauth-proxy/blob/master/twisted/plugins/proxy.py isn't installed (I think that's the Twisted "application")...

sorenlouv commented 11 years ago

Confirmed on OSX 10.8

bardusco commented 11 years ago

Confirmed on OSX 10.8.4

mojodna commented 11 years ago

Once upon a time, @zooko (the only Twisted god I know) helped me package this thing, all the while explaining the varying levels of incompatibility and breakage between SetupTools, distribute, easy_install, pip, Twisted, etc. The conclusion was ultimately that Twisted doesn't play well with setuptools and easy_install, so the fact that we ever had it working was somewhat of a miracle.

This ("Packaging a Twisted application") looks promising (from 2007), at least until one gets to:

Unfortunately Twisted and setuptools don't play nicely together, so I'm not able to package my Twisted app as an egg, take advantage of the setuptools package dependency resolution system, or install it using easy_install.

@zooko - do you know if this situation has changed at all in the intervening years?

koto commented 11 years ago

Temporary workaround - you have to unpack twisted/proxy.py from the application package:

  sudo pip install -d /tmp/ oauth-proxy

(or just get it from Github')

then locate place where Twisted holds it plugins and copy proxy.py there. On OSX 10.6 I just had to:

 sudo cp proxy.py  /System/Library/Frameworks/Python.framework/Versions/Current/Extras/lib/python/twisted/plugins
gagan-bansal commented 11 years ago

@koto the workaround you suggested is not working in Ubuntu 12.04.

devmage commented 11 years ago

On OSX 10.8.4 with Python installed at /usr/local/bin/python through Homebrew, I'm getting this problem as well. Setting PYTHONPATH did not help, nor did copying proxy.py. I am able to work around the problem, though, by using the system Python and utils, e.g:

sudo /usr/bin/easy_install oauth-proxy
...
/usr/bin/twistd -n oauth_proxy ...
2013-09-23 17:56:02-0700 [-] Log opened.
2013-09-23 17:56:02-0700 [-] twistd 12.0.0 (/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python 2.7.2) starting up.
2013-09-23 17:56:02-0700 [-] reactor class: twisted.internet.selectreactor.SelectReactor.
2013-09-23 17:56:02-0700 [-] OAuthProxyFactory starting on 8001
2013-09-23 17:56:02-0700 [-] Starting factory <oauth_proxy.oauth_proxy.OAuthProxyFactory instance at 0x10e550050>

Hope this helps!

gagan-bansal commented 11 years ago

Thanks Andrew for update, but still not working for me. My development is in javascript. I wanted to check the OAuth flow and this appeared very simple and easy to understand the Oauth flow from command line. So the current issue not very critical for me now.

devmage commented 11 years ago

Right, and I realize it's just a workaround for users in my particular situation. With any luck, it'll provide some insight into what's going on, and help a subset of users in the process.

mojodna commented 11 years ago

So...

I finally did something about the fact that all of you (and I) are unable to install this successfully/simply via any of the Python packaging systems--I rewrote it in JavaScript: node-oauth-proxy

npm install -g oauth-proxy

It's intended to be a drop-in replacement for the Python version, provided you don't mind installing Node. It now allows you to provide credentials in your environment (OAUTH_CONSUMER_KEY, etc., keeping them out of ps output) and is generally a simpler codebase to hack on (at least to me).

Give it a spin and let me know how it goes (issues + feature requests here). I'm thinking about adding some of the features from the OAuth Ruby library, such as the authorize command, which negotiates for an access token from the command-line (with some cut and paste that could eliminated by spinning up a lightweight web server to facilitate the flow).

zooko commented 11 years ago

Heh heh heh… nice solution, mojodna (https://github.com/mojodna/oauth-proxy/issues/4#issuecomment-25062436).

I'm sorry I didn't see your earlier request for help until just now.

I actually don't immediately recognize this problem or remember how to fix it. I'll see if I can figure it out…

mojodna commented 11 years ago

More options! With @zooko's fix in #5, it seems to be installing fine with pip!