aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMax Nanis2026-09-29 11:47:48 -0700
committerMax Nanis2026-09-29 11:47:48 -0700
commitcd173e67e4e0514271371f4a5e5136f7f61d06d1 (patch)
tree03d389b22cc02a4b1dd702eca0db1f13a43c4e3f /scripts
parent08643310a783d4da5212ef419ee8d909f683f8e2 (diff)
downloadamt-jb-cd173e67e4e0514271371f4a5e5136f7f61d06d1.tar.gz
amt-jb-cd173e67e4e0514271371f4a5e5136f7f61d06d1.zip
Redemption Modal. Redemption Magic flow. User Account Icondev
Diffstat (limited to 'scripts')
-rw-r--r--scripts/__init__.py0
-rw-r--r--scripts/unreject.py26
-rw-r--r--scripts/wallet.ipynb153
3 files changed, 0 insertions, 179 deletions
diff --git a/scripts/__init__.py b/scripts/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/scripts/__init__.py
+++ /dev/null
diff --git a/scripts/unreject.py b/scripts/unreject.py
deleted file mode 100644
index 298561f..0000000
--- a/scripts/unreject.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from jb.decorators import AMTM, AM
-from jb.flow.assignment_tasks import approve_assignment
-from jb.managers.amt import APPROVAL_MESSAGE
-
-res = AM.pg_config.execute_sql_query(
- """
-SELECT amt_assignment_id, submit_time, h.amt_hit_id, ht.amt_hit_type_id
-FROM mtwerk_assignment AS a
-LEFT JOIN mtwerk_hit AS h ON h.id = a.hit_id
-LEFT JOIN mtwerk_hittype AS ht ON h.hit_type_id = ht.id
-WHERE amt_worker_id='A1FMSKDAIK80PQ'
-and a.status = 2
-AND a.created_at>'2026-04-21 00:20:54.709322'
-ORDER BY a.created_at;
-"""
-)
-
-for x in res:
- approve_assignment(
- amtm=AMTM,
- am=AM,
- amt_assignment_id=x['amt_assignment_id'],
- msg=APPROVAL_MESSAGE,
- amt_hit_type_id=x['amt_hit_type_id'],
- override_rejection=True
- )
diff --git a/scripts/wallet.ipynb b/scripts/wallet.ipynb
deleted file mode 100644
index 12a90be..0000000
--- a/scripts/wallet.ipynb
+++ /dev/null
@@ -1,153 +0,0 @@
-{
- "cells": [
- {
- "metadata": {},
- "cell_type": "code",
- "source": [
- "import uuid\n",
- "\n",
- "import requests\n",
- "from collections import Counter\n",
- "\n",
- "FSB_BASE_URL = \"https://fsb.generalresearch.com/\"\n",
- "JB_BASE_URL = \"https://jamesbillings67.com/\"\n",
- "product_id = \"888dbc589987425fa846d6e2a8daed04\"\n",
- "bpuid = uuid.uuid4().hex"
- ],
- "id": "initial_id",
- "outputs": [],
- "execution_count": null
- },
- {
- "metadata": {},
- "cell_type": "code",
- "source": [
- "# Check their balance\n",
- "url = FSB_BASE_URL + f\"{product_id}/wallets/?bpuid={bpuid}\"\n",
- "print(f\"{url=}\")\n",
- "res = requests.get(url).json()\n",
- "print(res['displayed_balances'][0])"
- ],
- "id": "74a8d7f3452c2372",
- "outputs": [],
- "execution_count": null
- },
- {
- "metadata": {},
- "cell_type": "code",
- "source": [
- "# Get user cashout methods\n",
- "url = FSB_BASE_URL + f\"{product_id}/cashout_methods/?bpuid={bpuid}\"\n",
- "print(f\"{url=}\")\n",
- "res = requests.get(url).json()\n",
- "cms = res['cashout_methods']\n",
- "print(dict(Counter(x['type'] for x in cms)))\n",
- "\n",
- "# Get the paypal method\n",
- "paypal_cm = next(filter(lambda x: x['type'] == 'PAYPAL', cms))\n",
- "print(paypal_cm['id'])"
- ],
- "id": "e5c4e61b4727912d",
- "outputs": [],
- "execution_count": null
- },
- {
- "metadata": {},
- "cell_type": "code",
- "source": [
- "# Log in and retain the jb_session cookie for later requests\n",
- "from urllib.parse import parse_qs, urlparse\n",
- "\n",
- "session = requests.Session()\n",
- "email = 'your-email@gmail.com'\n",
- "\n",
- "res = session.post(\n",
- " JB_BASE_URL + 'auth/magic-link/request/',\n",
- " json={'email': email},\n",
- ")\n",
- "res.raise_for_status()\n",
- "print(res.json())"
- ],
- "id": "38c7d77b3abf9948",
- "outputs": [],
- "execution_count": null
- },
- {
- "metadata": {},
- "cell_type": "code",
- "source": [
- "# Paste the link from the login email. Exchanging it sets jb_session on `session`.\n",
- "magic_link = \"https://jamesbillings67.com/auth/magic-link/?token=XXXX\"\n",
- "token = parse_qs(urlparse(magic_link).query)['token'][0]\n",
- "res = session.post(\n",
- " JB_BASE_URL + 'auth/magic-link/exchange/',\n",
- " json={'token': token},\n",
- ")\n",
- "res.raise_for_status()\n",
- "\n",
- "session_token = session.cookies['jb_session']\n",
- "print(f'Logged in; captured jb_session ({len(session_token)} characters)')"
- ],
- "id": "db3caa6e440619fe",
- "outputs": [],
- "execution_count": null
- },
- {
- "metadata": {},
- "cell_type": "code",
- "source": [
- "# Request a PayPal cashout using the authenticated session.\n",
- "# The response confirms that the cashout confirmation email was sent;\n",
- "# the payout event is created only after that email link is confirmed.\n",
- "res = session.post(JB_BASE_URL + 'wallet/cashout/request/', json={\n",
- " 'amount': 10_00,\n",
- " 'cashout_method_id': paypal_cm['id'],\n",
- "})\n",
- "res.raise_for_status()\n",
- "print(res.json())"
- ],
- "id": "774a00c08ab54d4f",
- "outputs": [],
- "execution_count": null
- },
- {
- "metadata": {},
- "cell_type": "code",
- "source": [
- "# Paste link from email\n",
- "magic_link = \"https://jamesbillings67.com/wallet/cashout/confirm/?token=XXXX\"\n",
- "token = parse_qs(urlparse(magic_link).query)['token'][0]\n",
- "res = session.post(\n",
- " JB_BASE_URL + 'wallet/cashout/confirm/',\n",
- " json={'token': token},\n",
- ")\n",
- "print(res.json())\n",
- "res.raise_for_status()"
- ],
- "id": "894887ddc479eb1a",
- "outputs": [],
- "execution_count": null
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.6"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}