tmcknight / Movie-and-TV-Show-Search-Alfred-Workflow

An Alfred workflow to search for a movie (or TV show) and get a few ratings
MIT License
95 stars 7 forks source link

work behind a proxy #37

Closed sanjeevjohal closed 1 year ago

sanjeevjohal commented 1 year ago

doesn't work when behind a work proxy. Did try to change the get_json method which still didn't work

def get_json(url, params=None):
    try:
        if params:
            url += '?' + urllib.parse.urlencode(params)
        log(f'Fetchiddng {url}')
        # proxy_handler = urllib.request.ProxyHandler({'http': os.environ['http_proxy']})
        log(f'Proxy: {proxy_handler})')
        opener = urllib.request.build_opener(proxy_handler)
        response = opener.open(url)
        data = response.read().decode('utf-8')
        return json.loads(data)
    except Exception as e:
        log(e)
        return {"status_code": 500}
vitorgalvao commented 1 year ago

You don’t seem to be on the correct version of the workflow. The get_json function doesn’t look like that.