Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle API oauth httpd server conflicts with SABNzbd+ in Python
    primarykey
    data
    text
    <p>I'm writing a Python app that interacts with a Google API and requires user authentication via oauth2. </p> <p>I'm currently setting up a local authentication server to receive an oauth2 authentication code back from Google's oauth server, basically doing the oauth dance like <a href="http://code.google.com/apis/accounts/docs/OAuth2.html#installed" rel="nofollow">this</a>. </p> <p>It usually works pretty well, but I guess I'm not understanding exactly how it's interacting with my ports, because it will happily assign my local authentication server to run on port 8080 even if some other app (in the case of my testing, SABNzbd++) is using that port. </p> <p>I thought assigning the port to a used port number would result in an error and a retry. What am I doing wrong (or, alternatively, what is SABNzbd++ doing that keeps the fact that it's listening on port 8080 hidden from my app?)</p> <p>The relevant code is as follows.</p> <pre class="lang-py prettyprint-override"><code>import socket import BaseHTTPServer from oauth2client.tools import ClientRedirectServer, ClientRedirectHandler port_number = 0 host_name = 'localhost' for port_number in range(8080,10000): try: httpd = ClientRedirectServer((host_name, port_number), ClientRedirectHandler) except socket.error, e: print "socket error: " + str(e) pass else: print "The server is running on: port " + str(port_number) print "and host_name " + host_name break </code></pre> <p>To clarify, the following are my <strong>expected results</strong></p> <pre><code>socket error: [port already in use] (or something like that) The server is running on: port 8081 and host_name localhost </code></pre> <p>and then going to localhost:8080 resolves to SABnzbd+, and localhost:8081 resolves to my authentication server.</p> <p>I'm getting, howver:</p> <pre><code>the server is running on: port 8080 and host_name localhost </code></pre> <p>but going to localhost:8080 resolves to SABNzbd+</p> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload