Skip to content

Instantly share code, notes, and snippets.

@sclm
Created March 6, 2014 18:44
Show Gist options
  • Save sclm/9396634 to your computer and use it in GitHub Desktop.
Save sclm/9396634 to your computer and use it in GitHub Desktop.
Vimeo.py - Video Rename example
# Set up a VimeoClient instance:
import vimeo
client = vimeo.VimeoClient(ACCESS_TOKEN, CLIENT_ID, CLIENT_SECRET)
# Lets get the last (oldest by default) video that the authenticated user uploaded.
users_videos = client.me.videos()
# For now, we need to extract the ID.
# We can do this by taking the uri from the last item in the list,
# Splitting it on the slashes, then taking it's last element.
video_id = users_videos['body']['data'][-1:][0]['uri'].split('/')[-1:][0]
# From this, we can build the function chain. If we knew the ID to be 1, this would be:
# client.videos.1.patch(changes)
# So we do this with Python's getattr() built-in, and get:
getattr(client.videos, video_id).patch({'name': 'pyTest'})
@systmkor
Copy link

systmkor commented May 4, 2014

This just sets the Video Title to 'Untitled' when I try this.

@natfarleydev
Copy link

I found that this didn't rename the video. I just got the following output

{'headers': {'Cache-Control': 'no-cache, max-age=315360000',
  'Connection': 'Keep-Alive',
  'Content-Length': '0',
  'Content-Type': 'text/html; charset=UTF-8',
  'Date': 'Wed, 18 Jun 2014 06:21:58 GMT',
  'Expires': 'Sat, 15 Jun 2024 06:21:58 GMT',
  'Keep-Alive': 'timeout=100, max=27',
  'Location': '/videos/98197707',
  'Server': 'Apache',
  'Vary': 'Accept,Vimeo-Client-Id,Accept-Encoding'}}

Did you get anything similar systmkor?

@sclm
Copy link
Author

sclm commented Jun 18, 2014

@systmkor @nasfarley88 Sorry about that. It seems that the library was attempting to put the information into the query string and that was not working. I'm not sure when that bug was introduced, but it should be resolved with issue 9.

@systmkor Sorry I didn't see your issue earlier, if you ping twitter.com/vimeoapi then it should filter to an engineer that can handle it faster (sometimes that might be me).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment