[Tutor] Python OO
Juan C.
juan0christian at gmail.com
Mon Mar 30 02:39:30 CEST 2015
On Sun, Mar 29, 2015 at 8:55 PM Alan Gauld <alan.gauld at btinternet.com>
wrote:
Can you explain how that works? Does the user create their own
random unique values? Do you use a source of unique keys?
Or could the Actor init() maybe generate an ID for the user?
But without the API knowing the ID, how does the correct data get
selected? Surely there must be some kind of unique key for that to happen?
The ID is set by the API, I don't have control over it, I can't modify it,
and I don't really need to modify it. There is an option to search the API
using the name, like so (
http://private-anon-37abaab74-themoviedb.apiary-mock.com/3/search/person?query=Will%20Smith
).
Of course in the "user side" of the things I will ask for names, let's say.
The person wants to know all the movies that Will Smith played in. Of
course I won't ask the user for his ID (that is 287) because they wouldn't
know, the user will simply type his name.
And my code will call this part of the API to get the ID of the person, and
then create a new Actor using 'actor = Actor(287)'.
The same goes for Movie and Series related stuff, I just modify the
"/person?" to "/movie?" or "/tv?".
More information about the Tutor
mailing list