Module: binderhub.builder#

Handlers for working with version control services (i.e. GitHub) for builds.


class binderhub.builder.BuildHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)#

A handler for working with GitHub.

async check_quota(provider)#

Check quota before proceeding with build/launch


  • ServerQuotaCheck on success (None if no quota)


  • LaunchQuotaExceeded if quota exceeded

async emit(data)#

Emit an eventstream event

get(provider_prefix, _unescaped_spec)#

Get a built image for a given spec and repo provider.

Different repo providers will require different spec information. This function relies on the functionality of the tornado GET request.

  • provider_prefix (str) – the nickname for a repo provider (i.e. ‘gh’)

  • spec – specifies information needed by the repo provider (i.e. user, repo, ref, etc.)

async keep_alive()#

Constantly emit keepalive events

So that intermediate proxies don’t terminate an idle connection

async launch(provider)#

Ask JupyterHub to launch the image.


Stop keepalive when finish has been called

send_error(status_code, **kwargs)#

event stream cannot set an error code, so send an error event


Override this to set HTTP headers at the beginning of the request.

For example, this is the place to set a custom Server header. Note that setting such headers in the normal flow of request processing may not do what you want, since headers may be reset during error handling.