Skip to content

Commit

Permalink
Fix #89. Ignores SSL for retrieve cache files.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-mbm committed Dec 10, 2014
1 parent e708d34 commit 06d0426
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion grip/github_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def render_content(text, gfm=False, context=None,
headers = {'content-type': 'text/x-markdown'}

auth = (username, password) if username or password else None
r = requests.post(url, headers=headers, data=data, auth=auth)
r = requests.post(url, headers=headers, data=data, auth=auth, verify=False)

# Relay HTTP errors
if r.status_code != 200:
Expand Down
8 changes: 4 additions & 4 deletions grip/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _get_style_urls(source_url, style_pattern, asset_pattern,
return cached

# Find style URLs
r = requests.get(source_url)
r = requests.get(source_url, verify=False)
if not 200 <= r.status_code < 300:
print(' * Warning: retrieving styles gave status code',
r.status_code)
Expand Down Expand Up @@ -303,7 +303,7 @@ def _to_data_url(app, url, content_type):

def _download(app, url):
if urlparse(url).netloc:
return requests.get(url).content
return requests.get(url, verify=False).content

with app.test_client() as c:
return c.get(url).data
Expand Down Expand Up @@ -374,7 +374,7 @@ def _cache_contents(style_urls, asset_pattern, asset_pattern_sub, cache_path):
asset_urls = []
for style_url in style_urls:
filename = _cache_filename(style_url, cache_path)
contents = requests.get(style_url).text
contents = requests.get(style_url, verify=False).text
# Find assets and replace their base URLs with the cache directory
asset_urls += map(lambda url: urljoin(style_url, url),
re.findall(asset_pattern, contents))
Expand All @@ -385,7 +385,7 @@ def _cache_contents(style_urls, asset_pattern, asset_pattern_sub, cache_path):

for asset_url in asset_urls:
filename = _cache_filename(asset_url, cache_path)
contents = requests.get(asset_url).text
contents = requests.get(asset_url, verify=False).text
# Write file and show message
_write_file(filename, contents)
print(' * Cached', asset_url, 'in', cache_path)
Expand Down

0 comments on commit 06d0426

Please sign in to comment.