- 
                Notifications
    You must be signed in to change notification settings 
- Fork 48
allow setting user-agent value for fetching feeds #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| Yeah, you should ‘git --amend’ to get down to a single Signed-off-by allow setting user-agent value for fetching feeds Signed-off-by: Andres MRM andres@inventati.org for the whole commit message ;). | 
        
          
                rss2email/feed.py
              
                Outdated
          
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feed._fetch is a wrapper around feedparser.parse, which takes an agent argument (since v2?).  And Feed.load_from_config sets all the config entries as instance attributes.  So instead of setting _feedparser.USER_AGENT up top and doing this little dance here, I'd probably just use:
return f(
    self.url, self.etag, modified=self.modified,
    agent=self.user_agent or _USER_AGENT,
    **kwargs)
in Feed._fetch.
And we also use _USER_AGENT to set some headers, so those should also become self.user_agent or _USER_AGENT.
5844749    to
    b84259a      
    Compare
  
    | What about it now? Changed the code following your comment. =) (Used  | 
| On Wed, Dec 16, 2015 at 10:22:27PM -0800, Andrés Martano wrote: 
 Looks good to me, but you're still missing the header updates [1,2] 
 Yeah, I checked that. And the assignment happens here 4. 
 No, that's what you're supposed to do to push changes that | 
Signed-off-by: Andres MRM <andres@inventati.org>
b84259a    to
    068faa8      
    Compare
  
    | Sorry for the long delay. | 
| +1 for the feature -- I am experiencing user-agent filtering on some blogs too. | 
| @andresmrm I've opened rss2email/rss2email#48 to track this PR in the new https://github.com/rss2email/rss2email repository. Care to send this PR over there? :) | 
| Sorry for the delay. Done. Feel free to close the PR. | 
| Thank you! I can't really close this PR, but maybe @wking will come back some time and do it, if you don't want to do it yourself :) | 
Possibly fix this one:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=807748