Git Product home page Git Product logo

tvdbsimple's People

Contributors

3lixy avatar phate89 avatar rmartin16 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tvdbsimple's Issues

Exception during exception handling.

When using the following bad data request (there is no episode 15),

showeps = tvdb.Series_Episodes(78874, airedSeason=1, airedEpisode=15)
eps = showeps.all()

I saw an exception during the exception handling

  File "/home/troy/.local/lib/python3.5/site-packages/tvdbsimple/base.py", line 144, in _request
    raise Exception(response.json()['error'])
KeyError: 'error'

tvdb.Series_Episodes(id).all() only works once

After the first use of Series_Episodes it seems not to do anything apart from return an empty list.
In my application i have the debug http requests logged and only see a request made to the api endpoint on the first use of Series_Episodes.

Python 2.7.9
tvdbsimple==1.0.4

Example code to replicate the issue:

import tvdbsimple as tvdb
if __name__ == '__main__':
    tvdb.KEYS.API_KEY = 'your_api_key'
    eids = [78804, 281662, 267440]
    for eid in eids:
        blah = tvdb.Series_Episodes(eid).all()
        print(len(blah))

281
0
0

import tvdbsimple as tvdb
if __name__ == '__main__':
    tvdb.KEYS.API_KEY = 'your_api_key'
    eids = [78804, 281662, 267440]
    for eid in eids:
        blah = tvdb.Series(eid)
        bloo = blah.Episodes.all()
        print(len(bloo))

281
0
0

this works fine though

import tvdbsimple as tvdb
if __name__ == '__main__':
	tvdb.KEYS.API_KEY = 'your_api_key'
	eids = [78804, 281662, 267440]
	for eid in eids:
		blah = tvdb.Series_Images(eid).summary()
		print(len(blah))

5
4
5

show.Images.all() results in 405 client method not allowed.

>>> show = tvdb.Series('355567')
>>> art = show.Images.all()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/tvdbsimple/series.py", line 470, in all
    return self._get_image_type('images', language)
  File "/usr/local/lib/python2.7/dist-packages/tvdbsimple/series.py", line 480, in _get_image_type
    response = self._GET(path, params=filters)
  File "/usr/local/lib/python2.7/dist-packages/tvdbsimple/base.py", line 149, in _GET
    return self._request('GET', path, params=params, cleanJson=cleanJson)
  File "/usr/local/lib/python2.7/dist-packages/tvdbsimple/base.py", line 142, in _request
    return self._request(method=method, path=path, params=params, payload=payload, forceNewToken=True)
  File "/usr/local/lib/python2.7/dist-packages/tvdbsimple/base.py", line 146, in _request
    response.raise_for_status()
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 405 Client Error: Method Not Allowed for url: https://api.thetvdb.com/series/355567/images/query
>>> 

Can only use Search().series() once

It looks like in the Search().series() method, the series method is overwritten by the response from the request, but the response is also returned. This does not make much sense because each Search() instance can only be used once.

Authentication errors

So I am attempt a simple search as per below. I keep getting Auth issues, even tho the key is fine. I couldnt find where to set username and userkey but I tried hard coding them on the init but same issue. Im using python3.7

import tvdbsimple as tvdb
tvdb.KEYS.API_KEY = 'RCNBQO6OM61NLMWX'
search = tvdb.Search()
search.series("Dragon Ball")
for item in search.series:
	print(item['seriesName'])

Many Bugs and Pitfalls...FYI

For anyone finding this in the future, below are the issues I've found with this package...they are manageable but annoying. Not sure if the original author is responding to pull requests anymore. I can make one if so, though.

series.py
Series_Episodes:
- fixed _URLS{'queryparams'} to _URLS{'query_params'} so Series_Episodes.query_params() actually works
- converted _PAGES, _PAGES_LIST, and _FILTERS from class members to instance members so calls to Series_Episodes works more than once
Series_Images
- fixed _URLS{'queryparams'} to _URLS{'query_params'} so Series_Images.query_params() actually works
- Series_Images.all() bombs out if no filters are set
- call summary(), the other methods break since they have become integer attributes
- once one of the other methods is called, that method becomes a attribute of the response and thus uncallable

updates.py
Updates:
- fixed _URLS{'params'} init to _URLS{'update_params'} so Updates.update_params() actually works
- series can only be called once since it becomes a attribute after the first call...

search.py
Search
- fixed _URLS{'seriesparams'} to _URLS{'series_params'} so Search.series_params() actually works
- series can only be called once since it becomes an attribute after the first call

user.py
User_Ratings
- converted _PAGES, _PAGES_LIST, and _FILTERS from class members to instance members so calls to User_Ratings works more than once

base.py
TVDB
- if_requests gets a 404 back, raise Exception(response.json()['error']) blows up since 'error' isn't a valid key. should be 'Error'
- this is an awkward Exception anyway since its raised in a Try block and then a call to requests raises another exception...

Response Type

Hi I love what you do and love this library!!!

I have one problem:

my code:

search = tvdb.Search()
response = search.series("doctor who")

The response is a list type.
How do I convert it into a dict or dictionary type??

Can only call show.Images.poster() once

>>> show = tvdb.Series('355567')
>>> show.Images.poster()
[{u'languageId': 7, u'keyType': u'poster', u'fileName': u'posters/5c5c402b075cc.jpg', u'thumbnail': u'_cache/posters/5c5c402b075cc.jpg', u'subKey': u'', u'resolution': u'680x1000', u'id': 1337843, u'ratingsInfo': {u'count': 8, u'average': 8.9}}, {u'languageId': 7, u'keyType': u'poster', u'fileName': u'posters/5d120727011cc.jpg', u'thumbnail': u'_cache/posters/5d120727011cc.jpg', u'subKey': u'', u'resolution': u'680x1000', u'id': 1370927, u'ratingsInfo': {u'count': 2, u'average': 5.5}}, {u'languageId': 7, u'keyType': u'poster', u'fileName': u'posters/5d3a89fcb94fd.jpg', u'thumbnail': u'_cache/posters/5d3a89fcb94fd.jpg', u'subKey': u'', u'resolution': u'680x1000', u'id': 1377712, u'ratingsInfo': {u'count': 2, u'average': 8}}, {u'languageId': 7, u'keyType': u'poster', u'fileName': u'posters/5d3a8a73735d3.jpg', u'thumbnail': u'_cache/posters/5d3a8a73735d3.jpg', u'subKey': u'', u'resolution': u'680x1000', u'id': 1377713, u'ratingsInfo': {u'count': 2, u'average': 5.5}}, {u'languageId': 7, u'keyType': u'poster', u'fileName': u'posters/5d3a8b23f4139.jpg', u'thumbnail': u'_cache/posters/5d3a8b23f4139.jpg', u'subKey': u'', u'resolution': u'680x1000', u'id': 1377714, u'ratingsInfo': {u'count': 1, u'average': 1}}, {u'languageId': 7, u'keyType': u'poster', u'fileName': u'posters/5d3a8bed32870.jpg', u'thumbnail': u'_cache/posters/5d3a8bed32870.jpg', u'subKey': u'', u'resolution': u'680x1000', u'id': 1377716, u'ratingsInfo': {u'count': 1, u'average': 1}}, {u'languageId': 7, u'keyType': u'poster', u'fileName': u'posters/5d3a8c2304cbf.jpg', u'thumbnail': u'_cache/posters/5d3a8c2304cbf.jpg', u'subKey': u'', u'resolution': u'680x1000', u'id': 1377717, u'ratingsInfo': {u'count': 2, u'average': 5.5}}, {u'languageId': 7, u'keyType': u'poster', u'fileName': u'posters/5d3b88da98473.jpg', u'thumbnail': u'_cache/posters/5d3b88da98473.jpg', u'subKey': u'', u'resolution': u'680x1000', u'id': 1377868, u'ratingsInfo': {u'count': 3, u'average': 4}}, {u'languageId': 7, u'keyType': u'poster', u'fileName': u'posters/5d3b892d3fe4e.jpg', u'thumbnail': u'_cache/posters/5d3b892d3fe4e.jpg', u'subKey': u'', u'resolution': u'680x1000', u'id': 1377869, u'ratingsInfo': {u'count': 3, u'average': 7}}]
>>> show.Images.poster()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'list' object is not callable
>>> 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.