@@ -12,13 +12,13 @@ class Pixabay():
12
12
13
13
14
14
"""
15
+
15
16
def __init__ (self , verbose = True ):
16
17
self .bunch = '38504833-19606430bd8fde504120d1630'
17
18
self .name = 'Pixabay'
18
- self .verbose = verbose
19
+ self .verbose = verbose
19
20
20
21
def __get_params_video (self , query , num , update_params = {}):
21
-
22
22
"""
23
23
Class - `Pixabay`
24
24
Example:
@@ -48,7 +48,6 @@ def __get_params_video(self, query, num, update_params={}):
48
48
return params
49
49
50
50
def get_video (self , query , num = 10 , params = {}):
51
-
52
51
"""
53
52
Class - `Pixabay`
54
53
Example:
@@ -59,7 +58,7 @@ def get_video(self, query, num=10, params={}):
59
58
Returns: Downloads num number of videos into local storage.
60
59
61
60
"""
62
-
61
+
63
62
BASE_URL = 'https://pixabay.com/api/videos/'
64
63
_params = self .__get_params_video (query , num , params )
65
64
response = requests .get (BASE_URL , params = _params )
@@ -86,7 +85,7 @@ def __get_params_photo(self, query, num, update_params={}):
86
85
Returns:
87
86
```js
88
87
{
89
-
88
+
90
89
'q': query given by user,
91
90
'video_type': type of photo,
92
91
'orientation': orientation of the photo,
@@ -96,7 +95,7 @@ def __get_params_photo(self, query, num, update_params={}):
96
95
```
97
96
"""
98
97
params = {
99
-
98
+
100
99
'q' : query ,
101
100
'image_type' : 'photo' ,
102
101
'orientation' : 'horizontal' ,
@@ -117,7 +116,7 @@ def get_photo(self, query, num=10, params={}):
117
116
Returns: Downloads num number of photos into local storage.
118
117
119
118
"""
120
-
119
+
121
120
BASE_URL = 'https://pixabay.com/api/'
122
121
_params = self .__get_params_photo (query , num , params )
123
122
response = requests .get (BASE_URL , params = _params )
@@ -132,6 +131,3 @@ def get_photo(self, query, num=10, params={}):
132
131
if response is not None :
133
132
with open (f'photo_pixabay_{ i + 1 :02d} .jpg' , 'wb' ) as f :
134
133
f .write (response .content )
135
-
136
-
137
-
0 commit comments