Skip to main content

Honeygain.py

Upload Python Package

A python wrapper to interact with Honeygain's dashboard API.

Installation

$ pip install honeygain.py

Usage

import honeygain
from honeygain.schemas import UserProfile

EMAIL = 'mike@example.com'
PASS = 'V3ryZ3cUReP@sSw0rD'  # TODO: remove my totally real password

# log in...
client = honeygain.Client()
client.login(EMAIL, PASS)

# alternatively, if you already have a token:
# client.token = 'myAccessToken'

profile: UserProfile = client.get_profile()
print(f'--- Logged in as {profile.email} ---')
print(f'Created at:       {profile.created_at}')
print(f'JumpTask enabled: {profile.jumptask_mode}')
print(f'Active devices:   {profile.active_device_count} / {profile.total_device_count}')

A note about logging in

Due to the way this library works, running the above example will generate a new access token every time it's ran. Because of this, it is HEAVILY recommended that you store the access token somewhere and cache it so you do not have to call login() over and over.

Honeygain has set a very tight ratelimit on how often you can call the login endpoint, and they WILL prevent you from logging in again after a couple tries. When this happens, you are effectively locked out of your account and will have to try again the next day. That is, unless you have cached your access token like the smart person you are.

A very simple example to cache access tokens:

import honeygain

client = honeygain.Client()

# getting a stored access token
with open('token.txt', 'r') as file:
    client.token = file.read().strip()

# storing an access token after logging in
with open('token.txt', 'w+') as file:
    file.write(client.token)

Access tokens last for a very long time. If your token has expired, the API will tell you by raising a honeygain.HTTPException.

If you do get yourself locked out

Two options:

  1. Accept defeat. Your code is bad and you should feel bad. Try again tomorrow, or in an hour if you're lucky.
  2. If you are still logged in on a web browser:
    1. Open the honeygain dashboard
    2. Open devtools -> storage -> local storage
    3. Your token is listed under the JWT key for the dashboard domain.

Implemented endpoints

The base URL for all endpoints is https://dashboard.honeygain.com/api/v{version}. Version is 1 unless otherwise noted.

This library currently supports all endpoints of the Honeygain API as used by the official dashboard, and it is therefore able to get the same information and perform the same actions as you normally would through the dashboard.

General account
  • POST /users/tokens - Logging in with email + password
  • GET /users/me - Account details
  • GET /users/tos - ToS statistics
  • GET /devices - Currently active devices and stats about them. Note: uses API v2.
Notifications
  • GET /notifications?user_id=<user id> Get your notifications (why is there a user ID here??)
  • POST /notifications/<notif ID>/actions Interact with the notification
  • GET /contest_winnings Get the winnings of a contest. Can only be called after interacting with the notification as above.
Lifetime earnings
  • GET /earnings/jt - Lifetime earnings in JumpTask mode
  • GET /users/balances - Lifetime earnings for "normal" mode, as well as the minimum payout threshold
  • GET /referrals/earnings - Lifetime referral stats and earnings
Daily earnings
  • GET /earnings/stats - Detailed daily earnings in "normal" mode for the past month
  • GET /jt-earnings/stats - Detailed daily earnings in JumpTask mode for the past month
  • GET /earnings/wallet-stats - Daily earnings broken down into normal and JumpTask modes.
Current day earnings
  • GET /earnings/today - Current day earnings for "normal" mode, with detailed information about the origin of your earnings.
  • GET /jt-earnings/today - Current day earnings for JumpTask mode, with detailed information about the origin of your earnings.

Contributing

I realize that the way this library works right now might not be very intuitive at first - the issue is simply that Honeygain's (private!) API is not great. I've tried to introduce some improvements here and there, such as making property names more_pep8_compliant, but there's still a long way to go!

If you have any suggestions for the library, I'd be happy to accept pull requests. Please do create an issue before making large modifications though, so we can discuss the changes before you spend your entire afternoon on it :p

Release files for Honeygain.py 1.3.0

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

Source distribution (sdist)

Source distribution for Honeygain.py 1.3.0
File Size Uploaded
Honeygain.py-1.3.0.tar.gz 21.9 kB Details

Built distribution (wheel)

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

Total release size: 42.7 kB

Release files / Honeygain.py-1.3.0.tar.gz

Download URL Honeygain.py-1.3.0.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e76003f58752a6a5d0f69a29a285c1d2136855ce2573700eb602e5235d648785
BLAKE2b-256 checksum
How to use checksums
573ff3ceb82cc000c50bd9121b0fda9d35b336e1740e87d17a21b3b81bb917eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.13

Release files / Honeygain.py-1.3.0-py3-none-any.whl

Download URL Honeygain.py-1.3.0-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8339f4067328bb5eb2ca14dce3eaf3edceaa8c935b7a47ad0b6b55b5b04cc4c1
BLAKE2b-256 checksum
How to use checksums
e719c6e40a138963a01498d09247797c891293e1708bde696de1d0a1666bbc15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.13

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1

2 release files

1.0

2 release files

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