helpers: TMDB - include User-Agent in requests.

An attempt to get around cloudflare User-Agent block.
pull/152/head
salty 4 years ago
parent 0f34e3e58b
commit a2e5f2de0f
No known key found for this signature in database
GPG Key ID: 6FD3A9C593DA746D

@ -18,7 +18,8 @@ def validate_movie_tmdb_id(movie_title, movie_year, movie_tmdb_id):
def verify_movie_exists_on_tmdb(movie_title, movie_year, movie_tmdb_id):
try:
req = requests.get('https://www.themoviedb.org/movie/%s' % movie_tmdb_id)
headers = {"User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"}
req = requests.get('https://www.themoviedb.org/movie/%s' % movie_tmdb_id, headers=headers)
if req.status_code == 200:
log.debug("\'%s (%s)\' [TMDb ID: %s] exists on TMDb.", movie_title, movie_year, movie_tmdb_id)
return True

Loading…
Cancel
Save