creepo package

Submodules

httpproxy module

The httpproxy module exposes HttpProxy, whose httpproxy.rest_proxy() method handles each request.

By default the httpproxy module expects to support secure transmission protocols.

class httpproxy.HttpProxy(config, key)[source]

Bases: object

The http proxy

By default this class does not persist anything.

Enable persistence by setting the global configuration option no_cache = False

Parameters:
  • config – The global Creepo config

  • key – The storage key AND path prefix

property base

The base path to storage

dynamic_config(new_host)[source]

convenience method to generate a new config for a dynamic proxy

getheaders(environ)[source]

convenience method to get the proper headers for the request

gethttp()[source]

convenience method to configure the http request engine

property kind

The kind of proxy

mimetype(path, default)[source]

Return the default mimetype for the proxy

property no_cache

The no_cache property for this Proxy

persist(request)[source]

Persist the (possibly changed) data

rest_proxy(environ, start_response)[source]

The rest_proxy method is the work engine for everything

Parameters:
  • environ – The request Dictionary

  • start_response – The CherryPy callback

When environ contains a callback function that callback will be called after the initial request.

The callback might change the content. For this reason we replace the Content-Length header after the callback.

The (potentially modified) response is returned to the caller as a byte array at request[‘response’]

simpleproxy module

A simple proxy which does no callback.

This class supports docker, maven, and apk proxies

class simpleproxy.SimpleProxy(config, key)[source]

Bases: HttpProxy

A simple proxy for use with any repository which implements a simple REST interface, such as maven and apk. In the current code it is also used for docker, although docker requires a global kludge (docker must only be mounted at /v2)

Parameters:
  • config – The global Creepo config

  • key – The storage key prefix. The key is also the @cherrypy.expose endpoint, below

proxy(environ, start_response)[source]

Proxy a request

Parameters:
  • environ – The CherryPy request object

  • start_response – The WSGI callback

composerproxy module

Composer - proxy https://packagist.org for use by php developers

class composerproxy.ComposerProxy(config)[source]

Bases: object

Default configuration: { ‘registry’ : ‘https://packagist.org’ }

Exposed at endpoint /p2

When no_cache is not True then we will host selected ‘source’ and ‘dist’ packages

Configure a project to use Creepo by adding this to composer.json:

{
  "repositories": [
     {
       "type": "composer",
       "url": "https://${HOST_IP}:4443/p2/"
     }
  ],
}
callback(_input_bytes, request)[source]

When ComposerProxy acts as a registry it will retrieve meta-data from the configured upstream proxy.

If no_cache is not True then the source and dist urls of the meta-data are re-written to self-relative urls

proxy(environ, start_response)[source]

Proxy a composer request.

Creepo exposes a WSGI-compliant server at /p2

npmproxy module

An npm proxy

class npmproxy.NpmProxy(config)[source]

Bases: object

The npm proxy

callback(_input_bytes, request)[source]

callback - preprocess the file before saving it

proxy(environ, start_response)[source]

Proxy an npm request.

pipproxy module

The pip proxy

class pipproxy.PipProxy(config)[source]

Bases: object

The pip proxy

callback(_input_bytes, request)[source]

write the file to disk

proxy(environ, start_response)[source]

Proxy a pip repo request.