Permalink
Browse files

Merge branch 'master' of github.com:gengo/gengo-python

  • Loading branch information...
2 parents 73a87a4 + c4ad613 commit 557d3d6c21b572f0d9149404309b1dc0427b6996 @shawnps shawnps committed Dec 4, 2012
Showing with 25 additions and 16 deletions.
  1. +2 −2 gengo/__init__.py
  2. +17 −8 gengo/gengo.py
  3. +2 −2 gengo/mockdb.py
  4. +3 −3 gengo/tests.py
  5. +1 −1 setup.py
View
@@ -3,7 +3,7 @@
# noted. Details are below.
#
# New BSD License
-# Copyright (c) 2009-2012, myGengo, Inc.
+# Copyright (c) 2009-2012, Gengo, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -15,7 +15,7 @@
# Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
-# Neither the name of myGengo, Inc. nor the names of its contributors may
+# Neither the name of Gengo, Inc. nor the names of its contributors may
# be used to endorse or promote products derived from this software
# without specific prior written permission.
#
View
@@ -4,7 +4,7 @@
# noted. Details are below.
#
# New BSD License
-# Copyright (c) 2009-2012, myGengo, Inc.
+# Copyright (c) 2009-2012, Gengo, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -16,7 +16,7 @@
# Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
-# Neither the name of myGengo, Inc. nor the names of its contributors may
+# Neither the name of Gengo, Inc. nor the names of its contributors may
# be used to endorse or promote products derived from this software
# without specific prior written permission.
#
@@ -111,10 +111,10 @@ def __str__(self):
class Gengo(object):
def __init__(self, public_key=None, private_key=None, sandbox=False,
- api_version='2', headers=None, debug=False):
+ api_version='2', headers=None, debug=False, api_url=None):
"""
Gengo(public_key = None, private_key = None, sandbox = False,
- headers = None)
+ headers = None, debug=False, api_url=None)
Instantiates an instance of Gengo.
@@ -129,9 +129,15 @@ def __init__(self, public_key=None, private_key=None, sandbox=False,
'Bert'}
debug - a flag (True/False) which will cause the library to print
useful debugging info.
+ api_url - you can override the API url for calls if needed.
+ Version must be either append with '/%(version)s' or hardcoded ('/v2')
"""
- self.api_url = \
- api_urls['sandbox'] if sandbox is True else api_urls['base']
+ if api_url is None:
+ self.api_url = api_urls['sandbox'] if sandbox is True else \
+ api_urls['base']
+ else:
+ self.api_url = api_url
+
self.api_version = str(api_version)
if self.api_version not in ('1.1', '2'):
raise Exception("gengo-python library only supports " +
@@ -217,7 +223,7 @@ def get(self, **kwargs):
#
# Note: for further information on what's going on here, it's
# best to familiarize yourself with the Gengo authentication
- # API. (http://gengo.com/services/api/dev-docs/authentication)
+ # API. (http://developers.gengo.com/)
query_params = dict([k, quote(str(v).encode('utf-8'))] for k, v
in kwargs.items())
if self.public_key is not None:
@@ -331,7 +337,10 @@ def signAndRequestAPILatest(self, fn, base, query_params, post_data={},
if self.debug is True:
print base + '?%s' % query_string
return req_method(base + '?%s' % query_string,
- headers=self.headers)
+ headers=self.headers,
+ # Don't know why but requests is trying to verify
+ # SSL here ...
+ verify=False)
@staticmethod
def unicode2utf8(text):
View
@@ -3,7 +3,7 @@
# noted. Details are below.
#
# New BSD License
-# Copyright (c) 2009-2012, myGengo, Inc.
+# Copyright (c) 2009-2012, Gengo, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -15,7 +15,7 @@
# Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
-# Neither the name of myGengo, Inc. nor the names of its contributors may
+# Neither the name of Gengo, Inc. nor the names of its contributors may
# be used to endorse or promote products derived from this software
# without specific prior written permission.
#
View
@@ -5,7 +5,7 @@
# noted. Details are below.
#
# New BSD License
-# Copyright (c) 2009-2012, myGengo, Inc.
+# Copyright (c) 2009-2012, Gengo, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -17,7 +17,7 @@
# Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
-# Neither the name of myGengo, Inc. nor the names of its contributors may
+# Neither the name of Gengo, Inc. nor the names of its contributors may
# be used to endorse or promote products derived from this software
# without specific prior written permission.
#
@@ -125,7 +125,7 @@ def setUp(self):
single_job = {
'type': 'text',
'slug': 'Single :: English to Japanese',
- 'body_src': 'Test%ding myGe%dngo A%dPI li%dbrary calls.' %
+ 'body_src': 'Test%ding Ge%dngo A%dPI li%dbrary calls.' %
(int(random.randrange(1, 226, 1)),
int(random.randrange(1, 226, 1)),
int(random.randrange(1, 226, 1)),
View
@@ -107,7 +107,7 @@ def run(self):
'test': TestCommand,
},
classifiers=[
- 'Development Status :: 4 - Beta',
+ 'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Topic :: Software Development :: Libraries :: Python Modules',

0 comments on commit 557d3d6

Please sign in to comment.