Giter VIP home page Giter VIP logo

Comments (7)

benoitc avatar benoitc commented on July 17, 2024

Not sure what you mean, can you explain?

from restkit.

chassing avatar chassing commented on July 17, 2024

in class SimpleProxy (filter.py) i cant see any http proxy (not https) related thinks. there is a os.environ.get("https_proxy") and the https proxy handling, but no http_proxy stuff.

in other versions of SimpleProxy (maybe in other branches or older ones) was/is:

proxy = os.environ.get("https_proxy")
if proxy:
....
else:
proxy = os.environ.get("http_proxy")
if proxy:
...

from restkit.

benoitc avatar benoitc commented on July 17, 2024

mmm did you tested it ? If it doesn't work, let me know i will fix that.

from restkit.

chassing avatar chassing commented on July 17, 2024

i doesnt work :( here my testcode:

export http_proxy=http://proxy....:81
 
python test_restkit.py

DEBUG:restkit.client:Start to perform request: GET search.twitter.com /search.json?q=gunicorn
DEBUG:restkit.manager.base:key (('search.twitter.com', 80), False)
DEBUG:restkit.client:create new connection
DEBUG:restkit.client:close connection
DEBUG:restkit.client:socket error: getaddrinfo returns an empty list
Traceback (most recent call last):
  File "test_restkit.py", line 27, in 
    print s.search("gunicorn")
  File "test_restkit.py", line 19, in search
    return self.get('search.json', q=query)
  File "/Users/chassing/workspace/xmc/lib/python2.6/site-packages/restkit/resource.py", line 112, in get
    params_dict=params_dict, **params)
  File "test_restkit.py", line 22, in request
    resp = super(TwitterSearch, self).request(*args, **kwargs)
  File "/Users/chassing/workspace/xmc/lib/python2.6/site-packages/restkit/resource.py", line 188, in request
    headers=self.make_headers(headers))
  File "/Users/chassing/workspace/xmc/lib/python2.6/site-packages/restkit/client.py", line 558, in request
    return self.perform()
  File "/Users/chassing/workspace/xmc/lib/python2.6/site-packages/restkit/client.py", line 535, in perform
    raise RequestError(str(e))
restkit.errors.RequestError: getaddrinfo returns an empty list


cat test_restkit.py

from restkit import Resource
import logging

logging.basicConfig(level=logging.DEBUG)

try:
    import simplejson as json
except ImportError:
    import json # py2.6 only

class TwitterSearch(Resource):

    def __init__(self, **kwargs):
        search_url = "http://search.twitter.com"
        super(TwitterSearch, self).__init__(search_url, follow_redirect=True,
                                        max_follow_redirect=10, **kwargs)

    def search(self, query):
        return self.get('search.json', q=query)

    def request(self, *args, **kwargs):
        resp = super(TwitterSearch, self).request(*args, **kwargs)
        return json.loads(resp.body_string())

if __name__ == "__main__":
    s = TwitterSearch()
    print s.search("gunicorn")

from restkit.

benoitc avatar benoitc commented on July 17, 2024

will fix that asap. Probably on monday since i'm out for the we at FOSDEM.

  • benoit

from restkit.

benoitc avatar benoitc commented on July 17, 2024

last head should fix this issue, let me know :)

from restkit.

chassing avatar chassing commented on July 17, 2024

i've fixed some typos. http is working now. please have a lock filter.py line 80, proxy_uri is an undefined variable.

diff --git a/restkit/filters.py b/restkit/filters.py
index 2c1cd14..508091a 100644
--- a/restkit/filters.py
+++ b/restkit/filters.py
@@ -64,15 +64,15 @@ class SimpleProxy(object):
 
     def on_connect(self, client, sck, ssl):
         proxy_settings = os.environ.get('%s_proxy' %
-                self.client.parsed_url.scheme)
+                client.parsed_url.scheme)
 
         if not proxy_settings: 
             return
 
 
         if proxy_settings:
-            proxy_settings, proxy_auth =  _get_proxy_auth(proxy_setting)
-            addr = parse_netloc(proxy_settings)
+            proxy_settings, proxy_auth =  _get_proxy_auth(proxy_settings)
+            addr = parse_netloc(urlparse.urlparse(proxy_settings))
 
             if ssl:
                 if proxy_auth:

from restkit.

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.