Skip to content
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
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ include doc/Makefile
include doc/.templates/layout.html
prune doc/.build

include github2/*.crt

include tests/*.py
recursive-include tests/data *
4 changes: 1 addition & 3 deletions doc/api/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ API calls are limited by github.com to 1 per second by default. To have the
>>> github = Github(username="ask", api_token=".......",
... requests_per_second=1)

If you wish to use the library with a HTTP proxy, you will require a Python
SOCKS module installed. :pypi:`SocksiPy-branch` is the module we test with, but
various forks are available. Pass in the ``proxy_host`` and optionally
If you wish to use a HTTP proxy you can pass in the ``proxy_host`` and
``proxy_port`` settings to enable it. The default for ``proxy_port``, if not
given, is 8080::

Expand Down
1 change: 0 additions & 1 deletion doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ for handling HTTP sessions. :pypi:`python-dateutil` is used for its date
handling [#]_. :pypi:`simplejson` is also required when using :mod:`github2`
with Python 2.4 or 2.5. If you install via :pypi:`pip` or :pypi:`easy_install
<setuptools>` the dependencies should be installed automatically for you.
:pypi:`SocksiPy-branch` is an optional dependency if proxy support is needed.

.. [#] You must use :pypi:`python-dateutil` 1.x when working with Python 2.x,
the latest 2.x releases are for Python 3.x installations only.
23 changes: 23 additions & 0 deletions github2/DigiCert_High_Assurance_EV_Root_CA.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-----BEGIN CERTIFICATE-----
MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMSswKQYD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Ax2/S6cCZdkGCe
vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
+OkuE6N36B9K
-----END CERTIFICATE-----
17 changes: 7 additions & 10 deletions github2/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
import json as simplejson # For Python 2.6
except ImportError:
import simplejson
try:
import socks # SOCKS support may not be installed
except ImportError:
socks = None
from os import path
from urlparse import (urlsplit, urlunsplit)
try:
from urlparse import parse_qs
Expand Down Expand Up @@ -73,15 +70,15 @@ def __init__(self, username=None, api_token=None, url_prefix=None,
"api_version": self.api_version,
"api_format": self.api_format,
}
digicert_ha_cert = path.join(path.dirname(path.abspath(__file__ )),
"DigiCert_High_Assurance_EV_Root_CA.crt")
if proxy_host is None:
self._http = httplib2.Http(cache=cache)
elif proxy_host and socks is None:
raise GithubError('Proxy support missing. '
'Install a Python SOCKS library.')
self._http = httplib2.Http(cache=cache, ca_certs=digicert_ha_cert)
else:
proxy_info = httplib2.ProxyInfo(socks.PROXY_TYPE_HTTP,
proxy_info = httplib2.ProxyInfo(httplib2.socks.PROXY_TYPE_HTTP,
proxy_host, proxy_port)
self._http = httplib2.Http(proxy_info=proxy_info, cache=cache)
self._http = httplib2.Http(proxy_info=proxy_info, cache=cache,
ca_certs=digicert_ha_cert)

def encode_authentication_data(self, extra_post_data):
if self.access_token:
Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import github2


install_requires = ['httplib2', ]
install_requires = ['httplib2 >= 0.7.0', ]
# simplejson is included in the standard library since Python 2.6 as json.
if sys.version_info[:2] < (2, 6):
install_requires.append('simplejson >= 2.0.9')
Expand All @@ -35,6 +35,8 @@
keywords="git github api",
platforms=["any"],
packages=find_packages(exclude=['tests']),
include_package_data=True,
package_data={'': ['*.crt', ], },
entry_points={
'console_scripts': [
'github_manage_collaborators = github2.bin.manage_collaborators:main',
Expand All @@ -45,9 +47,6 @@
zip_safe=True,
test_suite="nose.collector",
tests_require=['nose'],
extras_require={
'SOCKS': ['SocksiPy-branch==1.01'],
},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class HttpMock(object):
Implementation tests should never span network boundaries
"""

def __init__(self, cache=None, timeout=None, proxy_info=None):
def __init__(self, cache=None, timeout=None, proxy_info=None, ca_certs=None):
"""Create a mock httplib.Http object

.. attribute: called_with
Expand Down
3 changes: 0 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ envlist = py24, py25, py26, py27, py31, py32, rst, sphinx
deps =
nose
coverage

# Optional dep, but required for tests
SocksiPy-branch
commands =
rm -rf build
{envpython} setup.py build
Expand Down