From 9dbf6e20ce43aecd9cdaddea32545b980f938c52 Mon Sep 17 00:00:00 2001 From: Jay Vala <24193355+jdvala@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:36:44 +0200 Subject: [PATCH] Add user agent in headers --- pexelsapi/pexels.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pexelsapi/pexels.py b/pexelsapi/pexels.py index ae4a107..7eea27e 100644 --- a/pexelsapi/pexels.py +++ b/pexelsapi/pexels.py @@ -12,7 +12,10 @@ def __init__(self, api_key): self.base_endpoint = 'https://api.pexels.com/v1/' self.video_endpoint = 'https://api.pexels.com/videos/' self.api_key = api_key - self.headers = {"Authorization": self.api_key} + self.headers = { + "Authorization": self.api_key, + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.3", + } def search_photos(self, query='ocean', orientation='', size='', color='', locale='', page=1, per_page=15): term = 'search'