Closed
Bug 1265007
Opened 10 years ago
Closed 10 years ago
No attribute 'quote' on running taskcluster.authenticate()
Categories
(Taskcluster :: Services, defect)
Taskcluster
Services
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: martianwars, Assigned: martianwars, Mentored)
Details
Attachments
(1 file)
Getting this error while I try to run taskcluster.authenticate() in mozci's tox tests https://pastebin.mozilla.org/8867851
| Assignee | ||
Updated•10 years ago
|
Mentor: jopsen, armenzg
Comment 1•10 years ago
|
||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mozci/sources/tc.py:310: in authenticate
taskcluster_client.authenticate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
description = 'Python script: `/home/kalpesh/Projects/mozilla_ci_tools/.tox/py27/local/lib/python2.7/site-packages/py/test.py`\n\nWould like some temporary credentials.'
def authenticate(description=None):
"""
Open a web-browser to login.taskcluster.net and listen on localhost for
a callback with credentials in query-string.
The description will be shown on login.taskcluster.net, if not provided
a default message with script path will be displayed.
"""
# Importing here to avoid loading these 'obscure' module before it's needed.
# Most clients won't use this feature, so we don't want issues with these
# modules to affect the library. Maybe they don't work in some environments
import webbrowser
from six.moves import urllib
import BaseHTTPServer
if not description:
script = '[interpreter/unknown]'
main = sys.modules.get('__main__', None)
if main and hasattr(main, '__file__'):
script = os.path.abspath(main.__file__)
description = (
"Python script: `%s`\n\nWould like some temporary credentials."
% script
)
creds = [None]
class AuthCallBackRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def log_message(format, *args):
pass
def do_GET(self):
url = urllib.parse.urlparse(self.path)
query = urllib.parse.parse_qs(url.query)
clientId = query.get('clientId', [None])[0]
accessToken = query.get('accessToken', [None])[0]
certificate = query.get('certificate', [None])[0]
hasCreds = clientId and accessToken and certificate
if hasCreds:
creds[0] = {
"clientId": clientId,
"accessToken": accessToken,
"certificate": certificate
}
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
if hasCreds:
self.wfile.write("""
<h1>Credentials transferred successfully</h1>
<i>You can close this window now.</i>
<script>window.close();</script>
""")
else:
self.wfile.write("""
<h1>Transfer of credentials failed!</h1>
<p>Something went wrong, you can navigate back and try again...</p>
""")
return
# Create server on localhost at random port
retries = 5
while retries > 0:
try:
server = BaseHTTPServer.HTTPServer(('', 0), AuthCallBackRequestHandler)
except:
retries -= 1
break
port = server.server_address[1]
> query = "?target=" + urllib.quote('http://localhost:' + str(port), '')
E AttributeError: 'Module_six_moves_urllib' object has no attribute 'quote'
Comment 2•10 years ago
|
||
You may need six.moves.urllib.parse.quote()
https://pythonhosted.org/six/#module-six.moves.urllib.parse
| Assignee | ||
Comment 3•10 years ago
|
||
I hope it's okay
Assignee: nobody → kalpeshk2011
Attachment #8742040 -
Flags: review?(jopsen)
| Assignee | ||
Comment 4•10 years ago
|
||
Can we consider this fixed?
Comment 5•10 years ago
|
||
Comment on attachment 8742040 [details] [review]
adding quote
r+'ed in PR by someone else, yay :)
Attachment #8742040 -
Flags: review?(jopsen)
Comment 6•10 years ago
|
||
@martianwars,
You are the reporter, so you tell me.. is it fixed? :)
Flags: needinfo?(kalpeshk2011)
| Assignee | ||
Comment 7•10 years ago
|
||
I'll have to wait for the new release I guess, before I can say anything about whether this PR fixed it
Flags: needinfo?(kalpeshk2011)
Comment 8•10 years ago
|
||
You can check out the repo and do "pip install -e ." (or the path to the taskcluster client repo)
Comment 9•10 years ago
|
||
0.3.0 was released this morning.
| Assignee | ||
Comment 10•10 years ago
|
||
Works for me now, thank you everyone :)
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Updated•7 years ago
|
Component: Client Libraries → Services
You need to log in
before you can comment on or make changes to this bug.
Description
•