~canonical-ci-engineering/adt-request-proxy/trunk

« back to all changes in this revision

Viewing changes to adt_request_proxy/v1.py

  • Committer: Thomi Richards
  • Date: 2015-03-10 20:41:29 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: thomi.richards@canonical.com-20150310204129-18r5snvzgfe0p7do
Feedback from code review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Version 1 restful service web code."""
19
19
 
 
20
import urllib.parse
 
21
 
20
22
from flask import current_app, request, url_for, jsonify
21
23
 
22
24
from adt_request_proxy.errors import MissingRequestParameters
47
49
        {
48
50
            'status': 'request processed',
49
51
            'request_id': req_id,
50
 
            'result_url': url_for('test_check', request_id=req_id)
 
52
            'result_url': urllib.parse.urljoin(
 
53
                current_app.config['SWIFT_URL'], req_id + '/results.tgz'
 
54
            )
51
55
        }
52
56
    )
53
57
    return repr(request.form)
54
 
 
55
 
 
56
 
def test_check(request_id):
57
 
    # TODO: use request_id to check if swift results tarball exists yet.
58
 
    # if it does, return it to the caller.
59
 
    status_dict = {
60
 
        'status': 'no results yet.',
61
 
        'request_id': req_id,
62
 
        'result_url': url_for('test_check', request_id=req_id)
63
 
    }
64
 
    return jsonify(status_dict)