~ursinha/ubuntu-ci-services-itself/401-copying-di-check

« back to all changes in this revision

Viewing changes to ppa-assigner/ppa_assigner/launchpad.py

  • Committer: Chris Johnston
  • Author(s): Ursula Junque (Ursinha)
  • Date: 2014-03-13 23:37:58 UTC
  • mfrom: (364.2.25 ppa-add-private)
  • Revision ID: chris_johnston-20140313233758-6yk9nlqiyo35jbh0
[r=Francis Ginther, PS Jenkins bot, Andy Doan] This branch adds 'private' to PPA, adds ability to get private and public information from launchpad and adds a variable to define we're using private or public ppas. 1290430 from Ursula Junque

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
def lp_collection(url):
26
26
    '''iterate through each item returned in an lp_collection'''
27
 
    resp = urllib2.urlopen(url)
 
27
    resp = _lp_get_authenticated(url)
28
28
    resp = resp.read()
29
29
    data = json.loads(resp)
30
30
 
54
54
    return {
55
55
        'Authorization': ', '.join(values),
56
56
        'Accept': 'application/json',
57
 
        'Content-Type': 'application/x-www-form-urlencoded'
58
57
    }
59
58
 
60
59
 
61
60
def _lp_post(url, data):
62
 
    req = urllib2.Request(url, urllib.urlencode(data), _oauth_headers())
 
61
    headers = _oauth_headers()
 
62
    headers['Content-Type'] = 'application/x-www-form-urlencoded'
 
63
    req = urllib2.Request(url, urllib.urlencode(data), headers)
 
64
    return urllib2.urlopen(req)
 
65
 
 
66
 
 
67
def _lp_get_authenticated(url):
 
68
    '''An authenticated GET to obtain also private information.'''
 
69
    req = urllib2.Request(url, headers=_oauth_headers())
63
70
    return urllib2.urlopen(req)
64
71
 
65
72