Skip to content

Commit

Permalink
Add poc
Browse files Browse the repository at this point in the history
  • Loading branch information
DerouineauNicolas committed Jun 17, 2024
1 parent 0c2fad3 commit 4d95b2d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions backend/poc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import requests

configuration_url = 'https://api.themoviedb.org/3/configuration?&api_key=5f65e3185346bf592091e8bacd724edf'
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=5f65e3185346bf592091e8bacd724edf'.format(movie)
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 4d95b2d

Please sign in to comment.