dgilland / omdb.py Goto Github PK
View Code? Open in Web Editor NEWPython wrapper around OMDb API (Open Movie Database): http://omdbapi.com
Home Page: http://omdbpy.readthedocs.org
License: Other
Python wrapper around OMDb API (Open Movie Database): http://omdbapi.com
Home Page: http://omdbpy.readthedocs.org
License: Other
How does one use their API key with this module?
TIA,
I want to use Sourcegraph for omdb.py code search, browsing, and usage examples. Can an admin enable Sourcegraph for this repository? Just go to https://sourcegraph.com/github.com/dgilland/omdb.py. (It should only take 30 seconds.)
Thank you!
omdb.set_default('apikey', OMDB_API_KEY)
omdb.set_default('tomatoes', True)
omdbresult = omdb.imdbid(a['imdbid'], timeout=10)
does not actually have fields such as tomato_url
and the like returned.
however:
omdb.set_default('apikey', OMDB_API_KEY)
omdbresult = omdb.imdbid(a['imdbid'], tomatoes=True, timeout=10)
does return the normal empty tomatoes fields, but most importantly, the populated tomato_url
field.
actually, it looks like .title()
suffers from this as well
I am ok using the parameter tomatoes=True if I must, but the docs reference omdb.set_default('tomatoes', True)
Thanks!
Why does the wrapper not have the new movies and shows. Shouldn’t it return the same content as the omdb api?
omdb requires a private api key now. Please add support.
Sample response that contains these fields: http://www.omdbapi.com/?i=tt2400770
Hi there,
for some reasons, it seems that the lib is unable to retrieve rottenTomatoes score.
I do have an API Key and I set tomatoes to True.
I fetch a movie that has a rotten tomatoes score on OMDB but in the result of the lib I get N/A for all tomatoes values.
Maybe something has been updated on the API but not the lib?
Thanks
Per official documentation found: https://media.readthedocs.org/pdf/omdbpy/latest/omdbpy.pdf
imdb_id field is incorrect in "Search Item" and "Get Item" documentation on GitHub.
After some troubleshooting I found that omdb.get(imdbid='tt0043456') does work.
I've trying to make it work but it doesn't even with the example of the readme of search_episode it doesn't return anything, it is deprecated or something?
>>> omdb.search_episode('True Grit') Search([])
This is my enviroment info:
Python 2.7.9 (default, Apr 2 2015, 15:33:21) [GCC 4.9.2] on linux2
when I follow the demo to use omdbapi ,but I get a error like this:
NameError Traceback (most recent call last)
in ()
----> 1 client = Client(apikey=API_KEY)
NameError: name 'API_KEY' is not defined
what should I do fix it? thanks a lot.
I've switched my Ubuntu system to now use Python 3.5.2. I've been updating my scripts as needed. I'm using the following in my script. This was working under Python 2.7.
from omdb import OMDBClient
client = OMDBClient(apikey = 'xxxxxx')
client.set_default('timeout', 10) #I set this value high during testing
jdata = client.imdbid(text) #I'm passing only the imdb number
This is the error output I get. Any help would be appreciated.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 377, in _make_request
httplib_response = conn.getresponse(buffering=True)
TypeError: getresponse() got an unexpected keyword argument 'buffering'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 379, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.5/http/client.py", line 1197, in getresponse
response.begin()
File "/usr/lib/python3.5/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.5/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.5/socket.py", line 575, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 376, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 610, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 247, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/lib/python3/dist-packages/six.py", line 686, in reraise
raise value
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 560, in urlopen
body=body, headers=headers)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 381, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 309, in _raise_timeout
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='www.omdbapi.com', port=80): Read timed out. (read timeout=10)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./movierenamer.py", line 315, in
IMDB, movie_title, movie_year, movie_foreign = search_movie(movieIMDB)
File "./movierenamer.py", line 83, in search_movie
jdata = client.imdbid(text) #dict
File "/usr/local/lib/python3.5/dist-packages/omdb/client.py", line 122, in imdbid
return self.get(imdbid=string, **params)
File "/usr/local/lib/python3.5/dist-packages/omdb/client.py", line 97, in get
data = self.request(**params).json()
File "/usr/local/lib/python3.5/dist-packages/omdb/client.py", line 50, in request
res = self.session.get(self.url, params=params, timeout=timeout)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 480, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='www.omdbapi.com', port=80): Read timed out. (read timeout=10)
The omdb.py
loosing the Episode data from season request.
For example for the http://www.omdbapi.com/?i=tt0944947&Season=1
the omdb api return
{
"Title": "Game of Thrones",
"Season": "1",
"totalSeasons": "8",
"Episodes": [
{
"Title": "Winter Is Coming",
"Released": "2011-04-17",
"Episode": "1",
"imdbRating": "9.0",
"imdbID": "tt1480055"
},
{
"Title": "The Kingsroad",
"Released": "2011-04-24",
"Episode": "2",
"imdbRating": "8.8",
"imdbID": "tt1668746"
},
{
"Title": "Lord Snow",
"Released": "2011-05-01",
"Episode": "3",
"imdbRating": "8.7",
"imdbID": "tt1829962"
},
{
"Title": "Cripples, Bastards, and Broken Things",
"Released": "2011-05-08",
"Episode": "4",
"imdbRating": "8.8",
"imdbID": "tt1829963"
},
{
"Title": "The Wolf and the Lion",
"Released": "2011-05-15",
"Episode": "5",
"imdbRating": "9.1",
"imdbID": "tt1829964"
},
{
"Title": "A Golden Crown",
"Released": "2011-05-22",
"Episode": "6",
"imdbRating": "9.2",
"imdbID": "tt1837862"
},
{
"Title": "You Win or You Die",
"Released": "2011-05-29",
"Episode": "7",
"imdbRating": "9.2",
"imdbID": "tt1837863"
},
{
"Title": "The Pointy End",
"Released": "2011-06-05",
"Episode": "8",
"imdbRating": "9.0",
"imdbID": "tt1837864"
},
{
"Title": "Baelor",
"Released": "2011-06-12",
"Episode": "9",
"imdbRating": "9.6",
"imdbID": "tt1851398"
},
{
"Title": "Fire and Blood",
"Released": "2011-06-19",
"Episode": "10",
"imdbRating": "9.4",
"imdbID": "tt1851397"
}
],
"Response": "True"
}
But the omdb.py return
{
"season": "1",
"response": "True",
"total_seasons": "8",
"title": "Game of Thrones"
}
when i try to use
item = omdb.imdbid("tt0080684")
i get back
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://www.omdbapi.com/?i=tt0080684&page=1&plot=short&apikey=########
My API Key is set and works. It seems the problem is the &page=1
.
while going to the URL http://www.omdbapi.com/?i=tt0080684&page=1&plot=short&apikey=########
it won't work.
however, moving the placement of the &page=1
to after plot will cause it to work http://www.omdbapi.com/?i=tt0080684&plot=short&page=1&apikey=########
There's definitely an issue with the API but as a workaround, I'm able to search by IMDb by using
item = omdb.imdbid("tt0080684", **{"page": None})
Should be pretty easy to drop in requests_cache flag along with parameters for caching. I have a lot of media to look up and it would definitely speed things up and reduce load on the server side!
Something like this seems to work in client.py:
self.session = requests_cache.CachedSession(cache_name='omdbapi_cache', expire_after=604800)
Obviously values for name/expire/backend could be passed in.
I noticed that call to omdb.get()
sometimes hung forever.
Why not specify a timeout=
parameter to the underlying requests.get()
call ?
When I created a client and initialized it with the API key, when trying to use the search method I get the following error:
>>> client.search('True Grit')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'OMDBClient' object has no attribute 'search'
I've checked the clients.py
file and it seems the client has access only to the .get()
function.
Could you please add the rest of the functionality?
Hi
How can I search an Italian title?
Example:
For the Italian title “Il richiamo della foresta” I have no results:
a. http://www.omdbapi.com/?t=Il+richiamo+della+foresta
For the original title “The Call of the Wild” I have results:
a. http://www.omdbapi.com/?t=The+Call+of+the+Wild
Stefano
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.