Comments (5)
which way calling Movie is better?
movie = tmdb.Movie(342)
info = movie.info()
video = movie.video()
images = movie.images()
or
info = tmdb.movie(342).info()
video =tmdb.movie(342).video()
image = tmdb.movie(342).images()
from tmdbsimple.
A good place to find more documentation and examples is the Closed Issues.
from tmdbsimple.
You can call Movies() either way. It's a matter of preference.
Movie Examples
import tmdbsimple as tmdb
tmdb.API_KEY = 'YOUR_API_KEY_HERE'
Call Format 1 - Instance attributes
Create an instance of the type Movies. Call methods on the instance (movie.info(), movie.videos(), and movie.images()). Then you can access the instance attributes (movie.title, movie.results, movie.posters[0]). See The Movie Database API for the names of the attributes. For example, https://developers.themoviedb.org/3/movies/get-movie-details for info() attributes.
movie = tmdb.Movies(342)
info = movie.info()
videos = movie.videos()
images = movie.images()
movie.title, movie.results, movie.posters[0]
('Summer Storm',
[{'id': '5581bf5c92514132b800001b',
'iso_3166_1': 'US',
'iso_639_1': 'en',
'key': 'A4YghiZxHfw',
'name': 'Trailer 1',
'site': 'YouTube',
'size': 360,
'type': 'Trailer'}],
{'aspect_ratio': 0.6790123456790124,
'file_path': '/o9J7BEdsv0fUl89WwUCCW9Iq9Xj.jpg',
'height': 4860,
'iso_639_1': 'en',
'vote_average': 5.377289377289378,
'vote_count': 2,
'width': 3300})
Call Format 2 - Direct Access
If you don't create an instance, you need to access the dict values directly.
info = tmdb.Movies(342).info()
videos = tmdb.Movies(342).videos()
images = tmdb.Movies(342).images()
info['title'], videos['results'], images['posters'][0]
('Summer Storm',
[{'id': '5581bf5c92514132b800001b',
'iso_3166_1': 'US',
'iso_639_1': 'en',
'key': 'A4YghiZxHfw',
'name': 'Trailer 1',
'site': 'YouTube',
'size': 360,
'type': 'Trailer'}],
{'aspect_ratio': 0.6790123456790124,
'file_path': '/o9J7BEdsv0fUl89WwUCCW9Iq9Xj.jpg',
'height': 4860,
'iso_639_1': 'en',
'vote_average': 5.377289377289378,
'vote_count': 2,
'width': 3300})
from tmdbsimple.
so calling two option have no different performance?
like option 1 take 0.3 s and option 2 take 0.25 something like that?
from tmdbsimple.
For this kind of programming, it's more important to care about readability than execution speed.
from tmdbsimple.
Related Issues (20)
- How to change the language of the data it returns to me HOT 3
- How to iterate over pages using tmdb.Movies("*") HOT 1
- keywords method in Movies have no kwargs HOT 1
- SSL issues recently? HOT 3
- Can't find "Watch" endpoint HOT 4
- HTTP requests concurrency problems v2.7.0 HOT 12
- Movies, People, Tv HOT 4
- Discover movies
- List of genres HOT 5
- Connection Error while calling Function HOT 1
- Movies credits incorrect request HOT 2
- No module named 'tmdbsimple' HOT 2
- poster_path is None even tho a poster exists HOT 2
- Feature request: Add support for watch providers
- Empty lists HOT 1
- Getting ssl errors recently HOT 1
- Dirty json response from tmdb
- 'Account' object has no attribute 'id' HOT 2
- Change language HOT 2
- Support for contributions to TMDB? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tmdbsimple.