Guest User

Untitled

a guest
Mar 29th, 2015
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. from pycinema.mdb import MovieDB
  4.  
  5.  
  6. API = MovieDB('API KEY GOES HERE')
  7.  
  8.  
  9. class Actor:
  10.     def __init__(self, actor_id):
  11.         api = API.get_actor(actor_id)
  12.         self.name = api['name']
  13.         self.biography = api['biography']
  14.         self.actorid = api['id']
  15.  
  16.  
  17. class Movie:
  18.     def __init__(self):
  19.         pass
  20.  
  21.  
  22. class Series:
  23.     def __init__(self):
  24.         pass
  25.  
  26.  
  27. ----------------------------------------------------------------------------
  28.  
  29.  
  30. # -*- coding: utf-8 -*-
  31.  
  32. import requests
  33.  
  34.  
  35. class MovieDB:
  36.     def __init__(self, api_key):
  37.         self.api_key = api_key
  38.  
  39.     def get_actor(self, actor_id):
  40.         response = requests.get('http://api.themoviedb.org/3/person/' + str(actor_id) + '?api_key=' + str(self.api_key)).json()
  41.         return {'name': response['name'], 'id': actor_id, 'biography': response['biography']}
Advertisement
Add Comment
Please, Sign In to add comment