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

Create account cleanup#6

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

Merged
schworer merged 4 commits intomasterfromcreate_account_cleanup
Dec 7, 2011
Merged
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
1 change: 1 addition & 0 deletions.gitignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,3 +2,4 @@
MANIFEST
dist/
env/
build/
17 changes: 16 additions & 1 deletiontest/test_zencoder.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@ def setUp(self):

def test_api_key(self):
""" initialize zencoder object and test api key """
api_key = 'abcd123'
api_key = 'testapikey'
zc = Zencoder(api_key=api_key)
self.assertEquals(zc.api_key, api_key)

Expand All@@ -19,6 +19,21 @@ def test_api_key_env_var(self):
zc = Zencoder()
self.assertEquals(zc.api_key, 'abcd123')

def test_default_api_version(self):
os.environ['ZENCODER_API_KEY'] = 'abcd123'
zc = Zencoder()
self.assertEquals(zc.base_url, 'https://app.zencoder.com/api/v2/')

def test_set_api_version(self):
os.environ['ZENCODER_API_KEY'] = 'abcd123'
zc = Zencoder(api_version='v1')
self.assertEquals(zc.base_url, 'https://app.zencoder.com/api/v1/')

def test_set_api_edge_version(self):
os.environ['ZENCODER_API_KEY'] = 'abcd123'
zc = Zencoder(api_version='edge')
self.assertEquals(zc.base_url, 'https://app.zencoder.com/api/')

if __name__ == "__main__":
unittest.main()

1 change: 1 addition & 0 deletionszencoder/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
from core import Zencoder
from core import ZencoderResponseError

from core import Account
5 changes: 2 additions & 3 deletionszencoder/core.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -45,7 +45,6 @@ def __init__(self, base_url, api_key, as_xml=False, resource_name=None, timeout=
if resource_name:
self.base_url = self.base_url + resource_name

#TODO investigate httplib2 caching and if it is necessary
self.http = httplib2.Http(timeout=timeout)
self.as_xml = as_xml
self.api_key = api_key
Expand DownExpand Up@@ -186,12 +185,12 @@ def __init__(self, base_url, api_key=None, as_xml=False, timeout=None):
"""
super(Account, self).__init__(base_url, api_key, as_xml, 'account', timeout=timeout)

def create(self, email, tos=True, options=None):
def create(self, email, tos=1, options=None):
"""
Creates an account with Zencoder, no API Key necessary.
"""
data = {'email': email,
'terms_of_service':int(tos)}
'terms_of_service':str(tos)}
if options:
data.update(options)

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp