Dailymotion API SDK for Python.
$ git clone [email protected]:dailymotion/dailymotion-sdk-python.git
$ cd dailymotion-sdk-python
$ python setup.py install
Public API call:
d = dailymotion.Dailymotion()
d.get('/videos')
Authenticated call:
d = dailymotion.Dailymotion()
d.set_grant_type('password', api_key=API_KEY, api_secret=API_SECRET,
scope=['userinfo'], info={'username': USERNAME, 'password': PASSWORD})
d.get('/me', {'fields': 'id,fullname'})
Video upload:
d = dailymotion.Dailymotion()
d.set_grant_type('password', api_key=API_KEY, api_secret=API_SECRET,
scope=['manage_videos'], info={'username': USERNAME, 'password': PASSWORD})
url = d.upload('./video.mp4')
d.post('/me/videos',
{'url': url, 'title': 'MyTitle', 'published': 'true', 'channel': 'news'})
-
Install Nose:
$ pip install nose
-
Create a new file named config.py with the following content:
CLIENT_ID = '[YOUR API KEY]' CLIENT_SECRET = '[YOUR API SECRET]' USERNAME = '[YOUR USERNAME]' PASSWORD = '[YOUR PASSWORD]' REDIRECT_URI = '[YOUR REDIRECT URI]' BASE_URL = 'https://api.dailymotion.com' OAUTH_AUTHORIZE_URL = 'https://www.dailymotion.com/oauth/authorize' OAUTH_TOKEN_URL = 'https://api.dailymotion.com/oauth/token'
-
Run tests:
$ nosetests -v