Skip to main content

Bounce

It's a keyword search engine, meaning you can configure it to redirect yt to Youtube, so a search like yt weird al would redirect right to Youtube's search.

1 minute getting started

  1. Install it

     $ pip install bounce
    
  2. Start it:

     $ bounce serve --host "127.0.0.1:5000"
    
  3. Query it:

     $ curl "http://127.0.0.1:5000/?q=yt weird al" 
    

Configuration

url configuration

Bounce has a built-in configuration file with generic mappings but you can also create your own that bounce will read when starting by setting the environment variable BOUNCE_CONFIG with a path to your custom configuration python file:

export BOUNCE_CONFIG=/path/to/bounce_config.py

The file must import bounce.config.commands:

from bounce.config import commands

The commands.add() method takes a space separated list of commands and a value:

commands.add("foo bar", "http://foo.com?q={}")

So, if you called bounce with the input:

foo blammo

It would redirect to:

http://foo.com?q=blammo

You could also call it with bar blammo and get the same thing because we set up the command keywords as foo bar so either foo or bar would redirect.

Notice that the value is a python format string.

callback configuration

value can also be a callback:

def callback(q):
    # manipulate q in some way and then return where you would like to go
    return 'http://some.url.that.needed.manipulation.q.com={}'.format(q)

commands.add("foo bar", callback)

That makes it so bounce can do all kinds of crazy things.

default configuration

By default, Google is the search engine of choice, so if you don't start your request with a command, bounce will redirect to Google search with your search string. If you would like to change this just pass default=True to one of your custom commands:

commands.add("keyword", "value", default=True)

Viewing configuration

the command ls will list all the commands bounce supports

Testing

To test locally from the repo:

$ export BOUNCE_CONFIG=/path/to/bounce/config.py
$ python -m bounce serve --host "127.0.0.1:5000"

That should produce output that ends with the bound hostname and port:

...
Server is listening on 127.0.0.1:5000

Which you can then use to test:

$ curl "http://127.0.0.1:5000/?q=..."

And that's it.

Docker

Start the bounce server in a docker container:

docker build --no-cache -t bounce . && docker run -p 127.0.0.1:4100:4100 -d --name bounce bounce

Stop and remove the docker container:

docker stop bounce && docker rm bounce

Metadata

Release files for bounce 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bounce 0.7.1
File Size Uploaded
bounce-0.7.1.tar.gz 10.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bounce 0.7.1
File Interpreter ABI Platform
bounce-0.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 20.5 kB

Release files / bounce-0.7.1.tar.gz

Download URL bounce-0.7.1.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3a331135eef3bb342e50a4c98f733ac6cca1e0bcefb4e3adc274785d708288d5
BLAKE2b-256 checksum
How to use checksums
ab54e33e543418ba5e80b94ea55079807270a26cc768aaa00ee1c186cfabceb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / bounce-0.7.1-py3-none-any.whl

Download URL bounce-0.7.1-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff203ea2912b086689274eb794ce208a1470be2ec084d8e268ccdf712dbe1745
BLAKE2b-256 checksum
How to use checksums
bdb9513fa22567005b1cb4c4ecb8e317d1908d6daf79ff8ca0a312cb25c1336d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release history Release notifications | RSS feed

This release

0.7.1 This release

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page