Skip to content
Snippets Groups Projects
Select Git revision
  • fe9b057f1135ba949a738a40a236d141396edc7c
  • master default protected
  • add-frequency-to-form
  • dev protected
  • ckan-2.11.0
  • add-package-custom-fields
  • fix-adding-datasets-for-users-and-editors
  • add-auth-subroute
  • 71-migrate-custom-fields-to-ckanext-scheming
  • add-author-maintainer-information
  • fix-inline-flex-btns
  • fix-known-spatial-uri-validation
  • py3
  • 47-aktuelle-resource-einer-collection-wird-nicht-mehr-gefunden
  • 10-eingabe-der-dct-accrualperiodicity-in-weboberflache
  • v1.3
  • 2.5.3
  • 2.5.2
  • 2.5.1
  • 2.5.0
  • 2.4.7
  • 2.4.6
  • 2.4.5
  • 2.4.4
  • 2.4.3
  • 2.4.2
  • 2.4.1
  • 2.4.0
  • 2.3.1
  • 2.3.0
  • 2.2.0
  • 2.1.0
  • 2.0.0
  • 1.4.3
  • 1.4.2
  • 1.4.1
36 results

test_harvest.py

Blame
  • setup_proxy.py 732 B
    import urllib2
    from ckan.common import config
    
    
    def setup_proxy():
        '''
        This function declares that a proxy server shall be used to access the web via
        urllib2. It takes the proxy address from ckan's config file 
        (
            field "ckanext.odsh.download_proxy",
            example: ckanext.odsh.download_proxy = http://1.2.3.4:4123
        )
        '''
    
        proxy_url = config.get('ckanext.odsh.download_proxy', None)
        if proxy_url:
            proxy = urllib2.ProxyHandler({'http': proxy_url, 'https': proxy_url})
            opener = urllib2.build_opener(proxy)
            urllib2.install_opener(opener)
    
    def clear_proxy():
        proxy = urllib2.ProxyHandler({})
        opener = urllib2.build_opener(proxy)
        urllib2.install_opener(opener)