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

Handle unicode logging #4

Merged
merged 1 commit into from Dec 1, 2011
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

handle unicode logging

  • Loading branch information
mLewisLogic
mLewisLogic committed Dec 1, 2011
commit b2170d69eae918127a359dbb1bdd3347442e63db
@@ -22,8 +22,14 @@ def newfunc(*args, **kwargs):
return wraps(func)(newfunc)


def post_to_endpoint(endpoint, message):
def post_to_endpoint(endpoint, message, encoding='utf-8'):
h = Http()
# If unicode, try to encode
if isinstance(message, unicode):
try:
message = message.encode(encoding)
except UnicodeEncodeError:
pass
h.request(endpoint, 'POST', message)
async_post_to_endpoint = async(post_to_endpoint)

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.