Skip to content

Commit

Permalink
Add imdb poc
Browse files Browse the repository at this point in the history
  • Loading branch information
DerouineauNicolas committed Jun 17, 2024
1 parent 0c2fad3 commit 9df078d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ SUBPROCESS_VERBOSE_OUTPUT=False

#Number of gunicorn worker (should be set accordingly to your hardware)
NUM_GUNICORN_WORKER=4

TMBD_KEY=
27 changes: 27 additions & 0 deletions backend/poc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import requests
import os

auth_key = os.getenv('TMBD_KEY')
if not auth_key:
print("no auth key")
exit()

configuration_url = 'https://api.themoviedb.org/3/configuration?&api_key={}'.format(auth_key)
response = requests.get(configuration_url)
value = response.json()

base_url = value["images"]["base_url"]
poster_size = value["images"]["poster_sizes"][0]


movie = "jackass"
api_url = 'https://api.themoviedb.org/3/search/movie?query={}&api_key={}'.format(movie, auth_key)
response = requests.get(api_url)
value = response.json()
print(value["results"][0])

poster_url = "{}/{}{}".format(base_url, poster_size, value["results"][0]["poster_path"])
response = requests.get(poster_url)

with open("jackass.jpeg", mode="wb") as file:
file.write(response.content)

0 comments on commit 9df078d

Please sign in to comment.