3232auto_changes_requested = set ()
3333auto_awaiting_upstream = set ()
3434delay_actions = [] # contains tuples of (datetime, email)
35+ http_headers = None
3536
3637
3738pw_act_active = {
@@ -189,7 +190,8 @@ def load_section(self, location, name):
189190
190191 self .loc_map [name ] = location
191192
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 )
193195 data = r .content .decode ('utf-8' )
194196
195197 offs = 0
@@ -208,7 +210,7 @@ def load_section(self, location, name):
208210
209211 # Now populate the plain text contents
210212 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 )
212214 data = r .content .decode ('utf-8' )
213215 lines = data .split ('\n ' )
214216
@@ -379,7 +381,8 @@ def _resolve_thread(self, pw):
379381
380382 self ._series_id = pw_obj [0 ]['series' ][0 ]['id' ]
381383
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 )
383386 data = r .content .decode ('utf-8' )
384387 msg = email .message_from_string (data , policy = default )
385388 self ._series_author = msg .get ('From' )
@@ -709,6 +712,11 @@ def main():
709712 signal .signal (signal .SIGTERM , handler )
710713 signal .signal (signal .SIGINT , handler )
711714
715+ global http_headers
716+ ua = config .get ('patchwork' , 'user-agent' , fallback = '' )
717+ if ua :
718+ http_headers = {"user-agent" :ua }
719+
712720 global authorized_users
713721 users = config .get ('mailbot' , 'authorized' )
714722 authorized_users .update (set (users .split (',' )))
0 commit comments