Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable SSL cert verification #36

Merged
merged 2 commits into from
Nov 25, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
dist/
rollbar.egg-info/
*.egg
.idea/
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

**0.8.4**
- Added an option to disable SSL certificate verification, (pr#36).
- Added `__version__` specifier to `__init__.py`.

**0.8.3**
- Provide a way to blacklist types from being repr()'d while gathering local variables.

Expand Down
14 changes: 10 additions & 4 deletions rollbar/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Plugin for Pyramid apps to submit errors to Rollbar
"""
__version__ = '0.8.4'

import copy
import inspect
Expand Down Expand Up @@ -127,7 +128,7 @@ def _get_pylons_request():

agent_log = None

VERSION = '0.8.3'
VERSION = __version__
DEFAULT_ENDPOINT = 'https://api.rollbar.com/api/1/'
DEFAULT_TIMEOUT = 3

Expand Down Expand Up @@ -167,7 +168,8 @@ def _get_pylons_request():
'locals': {
'enabled': True,
'sizes': DEFAULT_LOCALS_SIZES
}
},
'verify_https': True
}

# Set in init()
Expand Down Expand Up @@ -986,15 +988,19 @@ def _post_api(path, payload, access_token=None):
payload = ErrorIgnoringJSONEncoder().encode(payload)

url = urlparse.urljoin(SETTINGS['endpoint'], path)
resp = requests.post(url, data=payload, headers=headers, timeout=SETTINGS.get('timeout', DEFAULT_TIMEOUT))
resp = requests.post(url,
data=payload,
headers=headers,
timeout=SETTINGS.get('timeout', DEFAULT_TIMEOUT),
verify=SETTINGS.get('verify_https', True))
return _parse_response(path, SETTINGS['access_token'], payload, resp)


def _get_api(path, access_token=None, endpoint=None, **params):
access_token = access_token or SETTINGS['access_token']
url = urlparse.urljoin(endpoint or SETTINGS['endpoint'], path)
params['access_token'] = access_token
resp = requests.get(url, params=params)
resp = requests.get(url, params=params, verify=SETTINGS.get('verify_https', True))
return _parse_response(path, access_token, params, resp, endpoint=endpoint)


Expand Down
11 changes: 9 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import re
import os.path
from setuptools import setup, find_packages

HERE = os.path.abspath(os.path.dirname(__file__))

README_PATH = os.path.join(HERE, 'README.md')
try:
README = open(README_PATH).read()
with open(README_PATH) as fd:
README = fd.read()
except IOError:
README = ''

INIT_PATH = os.path.join(HERE, 'rollbar/__init__.py')
with open(INIT_PATH) as fd:
INIT_DATA = fd.read()
VERSION = re.search(r"^__version__ = ['\"]([^'\"]+)['\"]", INIT_DATA, re.MULTILINE).group(1)

setup(
name='rollbar',
packages=find_packages(),
version='0.8.3',
version=VERSION,
entry_points= {
'paste.filter_app_factory': [
'pyramid=rollbar.contrib.pyramid:create_rollbar_middleware'
Expand Down