barunsaha commited on
Commit
7bf36e8
1 Parent(s): 4bd6659

Update function signature

Browse files
Files changed (1) hide show
  1. helpers/image_search.py +6 -2
helpers/image_search.py CHANGED
@@ -4,7 +4,7 @@ Search photos using Pexels API.
4
  import os
5
  import random
6
  from io import BytesIO
7
- from typing import Union, Tuple, Optional
8
  from urllib.parse import urlparse, parse_qs
9
 
10
  import requests
@@ -14,7 +14,11 @@ REQUEST_TIMEOUT = 12
14
  MAX_PHOTOS = 2
15
 
16
 
17
- def search_pexels(query: str, size: Optional[str] = 'medium', per_page: int = MAX_PHOTOS):
 
 
 
 
18
  """
19
  Searches for images on Pexels using the provided query.
20
 
 
4
  import os
5
  import random
6
  from io import BytesIO
7
+ from typing import Union, Tuple, Literal
8
  from urllib.parse import urlparse, parse_qs
9
 
10
  import requests
 
14
  MAX_PHOTOS = 2
15
 
16
 
17
+ def search_pexels(
18
+ query: str,
19
+ size: Literal['small', 'medium', 'large'] = 'medium',
20
+ per_page: int = MAX_PHOTOS
21
+ ) -> dict:
22
  """
23
  Searches for images on Pexels using the provided query.
24