Skip to content

Commit

Permalink
Merge pull request #238 from pelson/cache_travis_token
Browse files Browse the repository at this point in the history
Correctly set the headers for *all* Travis requests.
  • Loading branch information
pelson authored Jul 22, 2016
2 parents 73ff327 + df87aa0 commit 464a9ba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
5 changes: 3 additions & 2 deletions conda_smithy/ci_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ def appveyor_configure(user, project):
content = response.json()
settings = content['settings']
skip_appveyor = u'skipBranchesWithoutAppveyorYml'
print('{: <30}: Current setting for {} = {}.'
''.format(project, skip_appveyor, settings[skip_appveyor]))
if not settings[skip_appveyor]:
print('{: <30}: Current setting for {} = {}.'
''.format(project, skip_appveyor, settings[skip_appveyor]))
settings[skip_appveyor] = True
url = 'https://ci.appveyor.com/api/projects'.format(user, project)

Expand Down
18 changes: 8 additions & 10 deletions conda_smithy/vendored/travis_encrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,14 @@ def handle_args():

def get_public_key(repo):
keyurl = 'https://api.travis-ci.org/repos/{0}/key'.format(repo)
try:
r = requests.get(keyurl)
r.raise_for_status()
except Exception as e:
raise SystemExit(e)
else:
try:
key = r.json()
except Exception as e:
raise SystemExit(e)
r = requests.get(keyurl,
headers={
# If the user-agent isn't defined correctly, we will recieve a 403.
'User-Agent': 'Travis/1.0',
'Accept': 'application/vnd.travis-ci.2+json',
'Content-Type': 'application/json'})
r.raise_for_status()
key = r.json()

return key.get('key')

Expand Down

0 comments on commit 464a9ba

Please sign in to comment.