Coder Social home page Coder Social logo

Comments (9)

gleitz avatar gleitz commented on September 26, 2024

Thanks for the bug report. Please try adding the following proxyDict in the get_result function of howdoi.py

$ howdoi requests proxy
http_proxy  = "10.10.1.10:3128"
https_proxy = "10.10.1.11:1080"
ftp_proxy   = "10.10.1.10:3128"
proxyDict = { 
              "http"  : http_proxy, 
              "https" : https_proxy, 
              "ftp"   : ftp_proxy
            }
r = requests.get(url, headers=headers, proxies=proxyDict)

I'm going to close this issue. Please let me know if this solution doesn't work.

from howdoi.

eddie-dunn avatar eddie-dunn commented on September 26, 2024

OK, after some more delving I realized that it's the "https" in in SEARCH_URL that made the script fail. Changing it to "http" solved everything (my proxies are already set system wide through environment variables, meaning howdoi uses them automatically).

Here's what I found about the problem:
http://stackoverflow.com/questions/11774612/python-requests-can-not-send-https-request
http://stackoverflow.com/questions/12343064/python-rauth-requests-openssl-cannot-get-api-twitter

The problem seems to be because of certificate verification errors, as I can do https requests with urllib2 -- and urllib2 doesn't do any certificate verification.

I realize my problem might be quite the corner-case, but would you accept a patch that modifies howdoi to use http as fallback-mode? I'd like to have it work out of the box :)

from howdoi.

eddie-dunn avatar eddie-dunn commented on September 26, 2024

OK, seems this is a known issue with the requests library: https://github.com/kennethreitz/requests/issues/1204

from howdoi.

sigmavirus24 avatar sigmavirus24 commented on September 26, 2024

@gleitz our proxy support may be changing (as of the next release). We might be requiring 'http://' and 'https://' for the URLs, e.g., 'http://10.10.1.10:3128'. Just wanted to give you a heads-up.

from howdoi.

gleitz avatar gleitz commented on September 26, 2024

Good sleuthing, @eddie-dunn! Would it be correct to assume that if I wait for the new requests release this issue will be fixed without any code changes to howdoi?

from howdoi.

eddie-dunn avatar eddie-dunn commented on September 26, 2024

Well, it looks like it may be a while before the issue is solved. Regardless, I think a fallback http-mode for howdoi is still a good idea.

from howdoi.

eddie-dunn avatar eddie-dunn commented on September 26, 2024

Well, it's been 5 months and nothing seems to have improved. Would you accept a pull request implementing an HTTP fallback mode?

from howdoi.

gleitz avatar gleitz commented on September 26, 2024

If the http-mode fallback works and does not negatively effect other users I would be happy to accept it.

from howdoi.

eddie-dunn avatar eddie-dunn commented on September 26, 2024

Cool. Pull request here: #60

from howdoi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.