diff --git a/.ci/bump_version.py b/.ci/bump_version.py deleted file mode 100644 index c2df52b..0000000 --- a/.ci/bump_version.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -""" -Script for bumping the version -""" - -import argparse -import re - - -def _main(): - parser = argparse.ArgumentParser() - parser.add_argument( - "versionfile", - type=str, - help="The version file to manage", - ) - parser.add_argument( - "--major", - action="store_true", - help="Update major", - ) - parser.add_argument( - "--minor", - action="store_true", - help="Update major", - ) - parser.add_argument( - "--micro", - action="store_true", - help="Update micro", - ) - parser.add_argument( - "--inplace", - "-i", - action="store_true", - help="Update the version file in place", - ) - args = parser.parse_args() - - with open(args.versionfile) as infile: - line = infile.readline() - res = re.match(r"^([0-9]+(\.[0-9]+){2})", line) - if not res: - raise RuntimeError("Unable to parse version file") - version = res.group(1) - - parts = version.split(".") - if args.major: - parts[0] = str(int(parts[0]) + 1) - elif args.minor: - parts[1] = str(int(parts[1]) + 1) - else: # Micro - parts[2] = str(int(parts[2]) + 1) - - version = ".".join(parts) - - # Print the version - print("{}".format(version)) - if args.inplace: - with open(args.versionfile, "w", newline="\n") as outfile: - outfile.write(version) - - -if __name__ == "__main__": - _main() diff --git a/.ci/prep_version.py b/.ci/prep_version.py deleted file mode 100644 index d2901a6..0000000 --- a/.ci/prep_version.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python -""" -Script to help manage the version file during the CI process. -""" - -import argparse -import re -import subprocess - - -def _main(): - parser = argparse.ArgumentParser() - parser.add_argument( - "versionfile", - type=str, - help="The version file to manage", - ) - parser.add_argument( - "--inplace", - "-i", - action="store_true", - help="Update the version file in place", - ) - group = parser.add_mutually_exclusive_group(required=True) - group.add_argument( - "--master", - action="store_true", - help="Return version for master branch CI (Final release)", - ) - group.add_argument( - "--develop", - action="store_true", - help="Return version for develop branch CI ('b' release)", - ) - group.add_argument( - "--dev-pr", - action="store_true", - help="Return version for PR onto develop branch CI ('a' release)", - ) - group.add_argument( - "--staging", - action="store_true", - help="Return version for staging branch CI ('c' canidate release)", - ) - parser.add_argument( - "--build-only", - action="store_true", - help="Only print post version tag info", - ) - args = parser.parse_args() - - # Read and parse the VERSION file - with open(args.versionfile) as infile: - line = infile.readline() - res = re.match(r"^([0-9]+(\.[0-9]+){2})", line) - if not res: - raise RuntimeError("Unable to parse version file") - version = res.group(1) - - proc = subprocess.run( - "git describe --tags --match v*".split(), - stdout=subprocess.PIPE, - check=True, - ) - describe_out = proc.stdout.decode() - - if not args.master: - # Pre-version letters - if args.staging: - pre_stage = "c" - elif args.develop: - pre_stage = "b" - elif args.dev_pr: - pre_stage = "a" - - # Replace string for development branches - if args.staging: - rep_str = pre_stage + r"\1" - else: - rep_str = pre_stage + r"\1+git.\2" - - # Update the version string - build = re.sub(r"v[0-9.]+-(\d+)-g(\w+)", rep_str, describe_out) - if args.build_only: - version = build - else: - version += build - - # Print the version - print("{}".format(version)) - if args.inplace: - with open(args.versionfile, "w", newline="\n", encoding="utf8") as outfile: - outfile.write(version) - - -if __name__ == "__main__": - _main() diff --git a/README.md b/README.md index 923563e..b797409 100644 --- a/README.md +++ b/README.md @@ -2,52 +2,47 @@
### A CLI app to perform Bing searches Please submit an issue or pull-request if you have an idea for a feature +- [Features](#features) - [Install](#installation) -- [Requirements](#requirements) - [Usage](#usage) -- [Config](#configuration) +- [Config](#options) +- [Development](#development--contribution) ## **Features** -* Script types search queries into the address bar, so must be run in a GUI environment. +* Enter random search queries into your browser a la Auto Hotkey. * Use a mobile user agent to get mobile points (`--mobile`) * Configurable number of searches with `--count=` -* All files are local, makes no http(s) requests -* Only one external dependance (pynput) +* Install as self-contained python application with minimal dependecies (`pynput`) * Fine tune delay and set browser executable with [config](#configuration) at `$XDG_CONFIG_HOME` or `%APPDATA%` on Windows -* Best Value: gift cards: **1,050 points / $1** (current rate) -*** ## **Installation** +### With [`pipx`](https://pipx.pypa.io/stable/) or `pip` ```bash -pip install bing-rewards +pipx install bing-rewards ``` Will make the executable `bing-rewards` available on your PATH. Look below or try the `--help` flag to see detailed usage. **Recommended**: Use a virtual environment or [`pipx`](https://pypa.github.io/pipx/) to avoid poluting your global package path with executable apps. See: [pipx](https://pypa.github.io/pipx/) -```bash -pipx install bing-rewards -``` -**NEW IN 2.0:** Now using the `pynput` backend with significantly less dependencies than the old `PyAutoGUI`. Delete any old virtual enviroment and reinstall to clean up old depdendencies. +### From releases +Download the latest release wheel and install with pip locally. -## **Requirements** +## **Dependencies** - At least Python 3.10 -- [pynput](https://github.com/moses-palmer/pynput) package is used to control keypresses and type Bing search URLS. +- [pynput](https://github.com/moses-palmer/pynput) (installed automatically). Used to control keypresses and type Bing search URLS. WARNING: This script *will* take control away from the keyboard while running. **Pynput** performs key presses. i.e., it does not operate headless or in the background. - `chrome` must be discoverable on the system PATH. [Download Google Chrome](https://www.google.com/intl/en/chrome/). @@ -56,10 +51,6 @@ If your chromium based browser has a different name use the `--exe` flag with an - To earn points from searching, you *must* also have logged into [bing.com](https://www.bing.com) with your Microsoft account at least once, to save cookies. ## **Usage** - -#### `bing-rewards [-h] [--no-window] [-n] [--exe EXE] [-c COUNT] [-d | -m] [--profile "Profile X"]` - -Ex: Complete mobile and desktop daily points `$ bing-rewards` @@ -81,7 +72,7 @@ Launches Chrome as a subprocess with special flags. Tested on Windows 10 and Lin ⚠️Bing has gotten more and more complex with the introduction of the AI tools. Disable as much as you can to make pages load faster. See PR #39 for some modifications you can make to the default search query url parameters that may improve success. -## **Configuration** +## **Options** Running with no options will complete mobile and desktop daily search quota. The following options are available to change the default behavior. @@ -114,12 +105,12 @@ Example config `~/.config/bing-rewards/config.json` "load-delay": 1.5, "search-delay": 2, "search-url": "https://www.bing.com/search?FORM=CHROMN&q=", - "desktop-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36 Edg/83.0.478.37", - "mobile-agent": "Mozilla/5.0 (Windows Phone 10.0; Android 6.0.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Mobile Safari/537.36 Edge/18.19041", + "desktop-agent": "Mozilla/5.0 ...