Skip to content

Commit 831599d

Browse files
authored
Merge pull request Clever#44 from Clever/support-refs
Support refs
2 parents 354fe0a + acd1e82 commit 831599d

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

clever/__init__.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
pass
5252
else:
5353
if major == 0 and (minor < 8 or (minor == 8 and patch < 8)):
54-
print('Warning: the Clever library requires that your Python "requests" library has a version no older than 0.8.8, but your "requests" library has version %s. Clever will fall back to an alternate HTTP library, so everything should work, though we recommend upgrading your "requests" library. If you have any questions, please contact [email protected]. (HINT: running "pip install -U requests" should upgrade your requests library to the latest version.)' % (
54+
print('Warning: the Clever library requires that your Python "requests" library has a version no older than 0.8.8, but your "requests" library has version %s. Clever will fall back to an alternate HTTP library, so everything should work, though we recommend upgrading your "requests" library. (HINT: running "pip install -U requests" should upgrade your requests library to the latest version.)' % (
5555
version, ), file=sys.stderr)
5656
_httplib = None
5757

@@ -72,7 +72,7 @@
7272

7373
if not _httplib:
7474
raise ImportError(
75-
"Clever requires one of pycurl, Google App Engine's urlfetch, or urllib2. If you are on a platform where none of these libraries are available, please let us know at [email protected].")
75+
"Clever requires one of pycurl, Google App Engine's urlfetch, or urllib2.")
7676

7777
from .version import VERSION
7878
from . import importer
@@ -234,7 +234,7 @@ def request_raw(self, meth, url, params={}):
234234
my_auth = self._auth or global_auth
235235
if my_auth is None:
236236
raise AuthenticationError(
237-
'No authentication method provided. (HINT: "clever.api_key = <API-KEY>" is deprecated. Set your API token using "clever.set_token(<OAUTH-TOKEN>)". You can generate API tokens from the Clever web interface. See https://clever.com/developers/docs for details, or email [email protected] if you have any questions.')
237+
'No authentication method provided. (HINT: "clever.api_key = <API-KEY>" is deprecated. Set your API token using "clever.set_token(<OAUTH-TOKEN>)". You can generate API tokens from the Clever web interface. See https://clever.com/developers/docs for details.')
238238
if my_auth.get('token') is None:
239239
raise AuthenticationError('Must provide api token auth. {}'.format(my_auth))
240240

@@ -274,7 +274,7 @@ def request_raw(self, meth, url, params={}):
274274
res = make_request[_httplib](meth, abs_url, headers, params)
275275
else:
276276
raise CleverError(
277-
"Clever Python library bug discovered: invalid httplib %s. Please report to [email protected]" % (_httplib, ))
277+
"Clever Python library bug discovered: invalid httplib %s. Please report to tech-[email protected]" % (_httplib, ))
278278
logger.debug('API request to %s returned (response code, response body) of (%d, %r)' %
279279
(abs_url, res['code'], res['body']))
280280
return res, my_auth
@@ -301,7 +301,7 @@ def requests_request(self, meth, abs_url, headers, params):
301301
headers['Content-Type'] = 'application/json'
302302
else:
303303
raise APIConnectionError(
304-
'Unrecognized HTTP method %r. This may indicate a bug in the Clever bindings. Please contact [email protected] for assistance.' % (meth, ))
304+
'Unrecognized HTTP method %r. This may indicate a bug in the Clever bindings. Please contact tech-[email protected] for assistance.' % (meth, ))
305305

306306
try:
307307
try:
@@ -334,10 +334,10 @@ def requests_request(self, meth, abs_url, headers, params):
334334

335335
def handle_requests_error(self, e):
336336
if isinstance(e, requests.exceptions.RequestException):
337-
msg = "Unexpected error communicating with Clever. If this problem persists, let us know at [email protected]."
337+
msg = "Unexpected error communicating with Clever. If this problem persists, let us know at tech-[email protected]."
338338
err = "%s: %s" % (type(e).__name__, e.message)
339339
else:
340-
msg = "Unexpected error communicating with Clever. It looks like there's probably a configuration issue locally. If this problem persists, let us know at [email protected]."
340+
msg = "Unexpected error communicating with Clever. It looks like there's probably a configuration issue locally. If this problem persists, let us know at tech-[email protected]."
341341
err = "A %s was raised" % (type(e).__name__, )
342342
if e.message:
343343
err += " with error message %s" % (e.message, )
@@ -367,7 +367,7 @@ def pycurl_request(self, meth, abs_url, headers, params):
367367
raise APIConnectionError("Did not expect params in DELETE request")
368368
else:
369369
raise APIConnectionError(
370-
'Unrecognized HTTP method %r. This may indicate a bug in the Clever bindings. Please contact [email protected] for assistance.' % (meth, ))
370+
'Unrecognized HTTP method %r. This may indicate a bug in the Clever bindings. Please contact tech-[email protected] for assistance.' % (meth, ))
371371

372372
# pycurl doesn't like unicode URLs
373373
abs_url = self._utf8(abs_url)
@@ -393,13 +393,13 @@ def handle_pycurl_error(self, e):
393393
if e[0] in [pycurl.E_COULDNT_CONNECT,
394394
pycurl.E_COULDNT_RESOLVE_HOST,
395395
pycurl.E_OPERATION_TIMEOUTED]:
396-
msg = "Could not connect to Clever (%s). Please check your internet connection and try again. If this problem persists, you should check Clever's service status at http://status.clever.com, or let us know at [email protected]." % (
396+
msg = "Could not connect to Clever (%s). Please check your internet connection and try again. If this problem persists, you should check Clever's service status at http://status.clever.com." % (
397397
api_base, )
398398
elif e[0] == pycurl.E_SSL_CACERT or e[0] == pycurl.E_SSL_PEER_CERTIFICATE:
399-
msg = "Could not verify Clever's SSL certificate. Please make sure that your network is not intercepting certificates. (Try going to %s in your browser.) If this problem persists, let us know at [email protected]." % (
399+
msg = "Could not verify Clever's SSL certificate. Please make sure that your network is not intercepting certificates. (Try going to %s in your browser)." % (
400400
api_base, )
401401
else:
402-
msg = "Unexpected error communicating with Clever. If this problem persists, let us know at [email protected]."
402+
msg = "Unexpected error communicating with Clever. If this problem persists, let us know at tech-[email protected]."
403403
msg = textwrap.fill(msg) + "\n\n(Network error: " + e[1] + ")"
404404
raise APIConnectionError(msg)
405405

@@ -415,7 +415,7 @@ def urlfetch_request(self, meth, abs_url, headers, params):
415415
raise APIConnectionError("Did not expect params in DELETE request")
416416
else:
417417
raise APIConnectionError(
418-
'Unrecognized HTTP method %r. This may indicate a bug in the Clever bindings. Please contact [email protected] for assistance.' % (meth, ))
418+
'Unrecognized HTTP method %r. This may indicate a bug in the Clever bindings. Please contact tech-[email protected] for assistance.' % (meth, ))
419419
args['url'] = abs_url
420420
args['method'] = meth
421421
args['headers'] = headers
@@ -435,14 +435,14 @@ def urlfetch_request(self, meth, abs_url, headers, params):
435435

436436
def handle_urlfetch_error(self, e, abs_url):
437437
if isinstance(e, urlfetch.InvalidURLError):
438-
msg = "The Clever library attempted to fetch an invalid URL (%r). This is likely due to a bug in the Clever Python bindings. Please let us know at [email protected]." % (
438+
msg = "The Clever library attempted to fetch an invalid URL (%r). This is likely due to a bug in the Clever Python bindings. Please let us know at tech-[email protected]." % (
439439
abs_url, )
440440
elif isinstance(e, urlfetch.DownloadError):
441441
msg = "There were a problem retrieving data from Clever."
442442
elif isinstance(e, urlfetch.ResponseTooLargeError):
443-
msg = "There was a problem receiving all of your data from Clever. This is likely due to a bug in Clever. Please let us know at [email protected]."
443+
msg = "There was a problem receiving all of your data from Clever. This is likely due to a bug in Clever. Please let us know at tech-[email protected]."
444444
else:
445-
msg = "Unexpected error communicating with Clever. If this problem persists, let us know at [email protected]."
445+
msg = "Unexpected error communicating with Clever. If this problem persists, let us know at tech-[email protected]."
446446
msg = textwrap.fill(msg) + "\n\n(Network error: " + str(e) + ")"
447447
raise APIConnectionError(msg)
448448

@@ -464,7 +464,7 @@ def urllib2_request(self, meth, abs_url, headers, params):
464464
raise APIConnectionError("Did not expect params in DELETE request")
465465
else:
466466
raise APIConnectionError(
467-
'Unrecognized HTTP method %r. This may indicate a bug in the Clever bindings. Please contact [email protected] for assistance.' % (meth, ))
467+
'Unrecognized HTTP method %r. This may indicate a bug in the Clever bindings. Please contact tech-[email protected] for assistance.' % (meth, ))
468468

469469
try:
470470
response = urllib2.urlopen(req)
@@ -480,7 +480,7 @@ def urllib2_request(self, meth, abs_url, headers, params):
480480
return {'body': rbody, 'headers': rheader, 'code': rcode}
481481

482482
def handle_urllib2_error(self, e, abs_url):
483-
msg = "Unexpected error communicating with Clever. If this problem persists, let us know at [email protected]."
483+
msg = "Unexpected error communicating with Clever. If this problem persists, let us know at tech-[email protected]."
484484
msg = textwrap.fill(msg) + "\n\n(Network error: " + str(e) + ")"
485485
raise APIConnectionError(msg)
486486

clever/importer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ def import_json():
1616
return simplejson
1717
except ImportError:
1818
if _json_loaded is None:
19-
raise ImportError("Clever requires a JSON library, which you do not appear to have. Please install the simplejson library. HINT: Try installing the python simplejson library via 'pip install simplejson' or 'easy_install simplejson', or contact [email protected] with questions.")
19+
raise ImportError("Clever requires a JSON library, which you do not appear to have. Please install the simplejson library. HINT: Try installing the python simplejson library via 'pip install simplejson' or 'easy_install simplejson'.")
2020
else:
21-
raise ImportError("Clever requires a JSON library with the same interface as the Python 2.6 'json' library. You appear to have a 'json' library with a different interface. Please install the simplejson library. HINT: Try installing the python simplejson library via 'pip install simplejson' or 'easy_install simplejson', or contact [email protected] with questions.")
21+
raise ImportError("Clever requires a JSON library with the same interface as the Python 2.6 'json' library. You appear to have a 'json' library with a different interface. Please install the simplejson library. HINT: Try installing the python simplejson library via 'pip install simplejson' or 'easy_install simplejson'.")

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
version=version.VERSION,
3232
description='Clever Python bindings',
3333
author='Clever',
34-
author_email='[email protected]',
34+
author_email='tech-[email protected]',
3535
url='https://clever.com/',
3636
packages=['clever'],
3737
package_data={'clever' : ['data/clever.com_ca_bundle.crt', 'VERSION']},

0 commit comments

Comments
 (0)