{"id":14037072,"url":"https://github.com/Jaymon/bounce","last_synced_at":"2025-07-27T04:34:01.794Z","repository":{"id":57416140,"uuid":"54770378","full_name":"Jaymon/bounce","owner":"Jaymon","description":"you type in things, it redirects you","archived":false,"fork":false,"pushed_at":"2024-08-02T17:20:39.000Z","size":86,"stargazers_count":2,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-28T10:05:58.814Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jaymon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-26T08:39:23.000Z","updated_at":"2024-08-02T17:20:42.000Z","dependencies_parsed_at":"2024-08-01T22:16:47.993Z","dependency_job_id":"15505ceb-e44f-44ca-928a-50844dfd4ed8","html_url":"https://github.com/Jaymon/bounce","commit_stats":{"total_commits":61,"total_committers":1,"mean_commits":61.0,"dds":0.0,"last_synced_commit":"8dd4e405cc9bc4336f74cd7a767c34e8bfdcbd22"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fbounce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fbounce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fbounce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fbounce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jaymon","download_url":"https://codeload.github.com/Jaymon/bounce/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227762453,"owners_count":17816028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-12T03:02:27.594Z","updated_at":"2024-12-02T16:31:47.581Z","avatar_url":"https://github.com/Jaymon.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Bounce\n\nIt'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.\n\n\n## 1 minute getting started\n\n1. Install it\n\n        $ pip install bounce\n\n2. Start it:\n\n        $ bounce serve --host \"127.0.0.1:5000\"\n\n3. Query it:\n\n        $ curl \"http://127.0.0.1:5000/?q=yt weird al\" \n\nYou can also run it using any WSGI server like [uWSGI](http://projects.unbit.it/uwsgi/) using the included `bouncefile.py` as the `wsgi-file`.\n\n\n## Configuration\n\n\n### url configuration\n\nBounce has a built-in [configuration file with generic mappings](https://github.com/Jaymon/bounce/blob/master/bounce/config.py) 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:\n\n```bash\nexport BOUNCE_CONFIG=/path/to/bounce_config.py\n```\n\nThe file must import `bounce.config.commands`:\n\n```python\nfrom bounce.config import commands\n```\n\nThe `commands.add()` method takes a space separated list of commands and a value:\n\n```python\ncommands.add(\"foo bar\", \"http://foo.com?q={}\")\n```\n\nSo, if you called bounce with the input:\n\n    foo blammo\n\nIt would redirect to:\n\n    http://foo.com?q=blammo\n\nYou 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.\n\nNotice that the value is a [python format string](https://docs.python.org/2/library/string.html#formatspec).\n\n\n### callback configuration\n\nvalue can also be a callback:\n\n```python\ndef callback(q):\n    # manipulat q in some way and then return where you would like to go\n    return 'http://some.url.that.needed.manipulation.q.com={}'.format(q)\n\ncommands.add(\"foo bar\", callback)\n```\n\nThat makes it so bounce can do all kinds of crazy things.\n\n\n### default configuration\n\nBy 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:\n\n```python\ncommands.add(\"keyword\", \"value\", default=True)\n```\n\n\n### Viewing configuration\n\n\nthe command `ls` will list all the commands bounce supports\n\n\n## Testing\n\nTo test locally from the repo:\n\n    $ export BOUNCE_CONFIG=/path/to/bounce/config.py\n    $ python -m bounce serve --host \"127.0.0.1:5000\"\n\nThat should produce output that ends with the bound hostname and port:\n\n    ...\n    Server is listening on 127.0.0.1:5000\n\nWhich you can then use to test:\n\n    $ curl \"http://127.0.0.1:5000/?q=...\"\n\nAnd that's it.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJaymon%2Fbounce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJaymon%2Fbounce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJaymon%2Fbounce/lists"}