Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow for the JSON module to be configured.#30

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
schworer wants to merge3 commits intomaster
base:master
Choose a base branch
Loading
fromfeature/configurable-json-module
Open
Show file tree
Hide file tree
Changes fromall 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
9 changes: 8 additions & 1 deletion.travis.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,14 @@ python:
- "3.3"
- "3.4"
- "pypy"
install: pip install -e .
env:
matrix:
- ZENCODER_PY_JSON_MODULE=simplejson
- ZENCODER_PY_JSON_MODULE=json

install:
- pip install simplejson
- pip install -e .
# command to run tests
script: nosetests

4 changes: 4 additions & 0 deletionsREADME.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,6 +28,10 @@ client = Zencoder('API_KEY')
client = Zencoder()
```

#### Configuring the JSON Module

By default, zencoder-py uses the built-in `json` module, but you can optionally configure it to use `simplejson` by setting the `ZENCODER_PY_JSON_MODULE` environment variable to `simplejson`. Note that zencoder-py will not install either module, it must already be installed.

## [Jobs](https://app.zencoder.com/docs/api/jobs)

Create a [new job](https://app.zencoder.com/docs/api/jobs/create).
Expand Down
22 changes: 7 additions & 15 deletionszencoder/core.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,21 +2,13 @@
import requests
from datetime import datetime

# Note: I've seen this pattern for dealing with json in different versions of
# python in a lot of modules -- if there's a better way, I'd love to use it.
try:
# python 2.6 and greater
import json
except ImportError:
try:
# python 2.5
import simplejson
json = simplejson
except ImportError:
# if we're in django or Google AppEngine land
# use this as a last resort
from django.utils import simplejson
json = simplejson
json_module = os.environ.get('ZENCODER_PY_JSON_MODULE', 'json')
valid_json_modules = ('json', 'simplejson')
if json_module not in valid_json_modules:
msg = 'ZENCODER_PY_JSON_MODULE=%s is not supported. Supported JSON modules: %s' % (json_module, ', '.join(valid_json_modules))
raise RuntimeError(msg)

json = __import__(json_module)

__version__ = '0.6.5'

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp