0

I have an script using Python and PyVimeo that I am working on to use the "GEThttps://api.vimeo.com/videos/{video_id}" so I can get the file name. When I try to run my app, I am getting an error {'error': "The requested video couldn't be found."}. However, when I use this same video ID under the Try it out section (https://developer.vimeo.com/api/reference/videos#get_video), it works fine.

I am assuming there is something wrong with my code, but if I use the demo from the github example (about_me = v.get('/me')), it works fine and that needs authentication as well.

Is there something simple I am missing? Thank you so much.

import vimeo

v = vimeo.VimeoClient(
token= 'VimeoToken',
key= 'VimeoKey',
secret= 'VimeoSecret'
)

class Vimeo:
def get_vimeo_data(video_file):
uri = 'https://api.vimeo.com/videos/{video_file}'
# uri = 'https://api.vimeo.com/me/videos' - This response works
response = v.get(uri)

data = response.json()
print(data)

Vimeo.get_vimeo_data(55555)
user3324136
  • 415
  • 5
  • 20

1 Answers1

1

You forgot to add an f before your f-string.

class Vimeo:
    def get_vimeo_data(video_file):
        # THIS f
        uri = f"https://api.vimeo.com/videos/{video_file}"
        # uri = 'https://api.vimeo.com/me/videos' - This response works
        response = v.get(uri)

        data = response.json()
        print(data)
Siddharth Dushantha
  • 1,391
  • 11
  • 28
  • Thank you so much for your comment. I think I entered " instead of ' . It should look like this. `uri = 'https://api.vimeo.com/videos/{video_file}'` – user3324136 Nov 22 '21 at 16:43
  • @user3324136 if my answer solved your question please click on the check mark to accept my answer :) – Siddharth Dushantha Nov 23 '21 at 20:19
  • Thank you Siddharth. I certainly will give you an up vote. Right now, however, the issue is that I am not trying to use an F string but use the URI to get the JSON from the video file. I corrected the code above to reflect what I was trying to do and (my apologies) somehow quotes got placed in it accidentally. – user3324136 Nov 24 '21 at 01:40
  • 1
    My apologies, Siddharth. I had not fully read through your answer and it was indeed correct. Thanks again for your help. – user3324136 Nov 26 '21 at 16:04