32
32
auto_changes_requested = set ()
33
33
auto_awaiting_upstream = set ()
34
34
delay_actions = [] # contains tuples of (datetime, email)
35
+ http_headers = None
35
36
36
37
37
38
pw_act_active = {
@@ -189,7 +190,8 @@ def load_section(self, location, name):
189
190
190
191
self .loc_map [name ] = location
191
192
192
- r = requests .get (f'https://www.kernel.org/doc/html/next/{ location } .html' )
193
+ r = requests .get (f'https://www.kernel.org/doc/html/next/{ location } .html' ,
194
+ headers = http_headers )
193
195
data = r .content .decode ('utf-8' )
194
196
195
197
offs = 0
@@ -208,7 +210,7 @@ def load_section(self, location, name):
208
210
209
211
# Now populate the plain text contents
210
212
url = f'https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/plain/Documentation/{ location } .rst'
211
- r = requests .get (url )
213
+ r = requests .get (url , headers = http_headers )
212
214
data = r .content .decode ('utf-8' )
213
215
lines = data .split ('\n ' )
214
216
@@ -379,7 +381,8 @@ def _resolve_thread(self, pw):
379
381
380
382
self ._series_id = pw_obj [0 ]['series' ][0 ]['id' ]
381
383
382
- r = requests .get (f'https://lore.kernel.org/all/{ mid } /raw' )
384
+ r = requests .get (f'https://lore.kernel.org/all/{ mid } /raw' ,
385
+ headers = http_headers )
383
386
data = r .content .decode ('utf-8' )
384
387
msg = email .message_from_string (data , policy = default )
385
388
self ._series_author = msg .get ('From' )
@@ -709,6 +712,11 @@ def main():
709
712
signal .signal (signal .SIGTERM , handler )
710
713
signal .signal (signal .SIGINT , handler )
711
714
715
+ global http_headers
716
+ ua = config .get ('patchwork' , 'user-agent' , fallback = '' )
717
+ if ua :
718
+ http_headers = {"user-agent" :ua }
719
+
712
720
global authorized_users
713
721
users = config .get ('mailbot' , 'authorized' )
714
722
authorized_users .update (set (users .split (',' )))
0 commit comments