Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

issue #2 i hope it's fixed

  • Loading branch information...
commit 27cc2847d3d7b25c6b8f222fc0c1cda66c8f0a63 1 parent e369b48
@doganaydin authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 tmdb.py
View
8 tmdb.py
@@ -47,13 +47,17 @@ def configure(api_key):
class Core(object):
def getJSON(self,url):
- url = url.replace(" ","+")
page = requests.get(url).content
try:
return simplejson.loads(page)
except:
return simplejson.loads(page.decode('utf-8'))
+ def escape(self,text):
+ if len(text) > 0:
+ return requests.utils.quote(text)
+ return False
+
def update_configuration(self):
c = self.getJSON(config['urls']['config'])
config['api']['backdrop.sizes'] = c['images']['backdrop_sizes']
@@ -77,6 +81,7 @@ def profile_sizes(self,img_size):
class Movie(Core):
def __init__(self, title="", id=-1):
self.update_configuration()
+ title = self.escape(title)
self.movies = self.getJSON(config['urls']['movie.search'] % (title,str(1)))
self.movies_full = ""
pages = self.movies["total_pages"]
@@ -222,6 +227,7 @@ def get_vote_count(self,movie_id=0):
class People(Core):
def __init__(self, people_name, id=-1):
self.update_configuration()
+ people_name = self.escape(people_name)
self.people = self.getJSON(config['urls']['people.search'] % (people_name,str(1)))
pages = self.people["total_pages"]
self.person = ""
Please sign in to comment.
Something went wrong with that request. Please try again.