Skip to main content

Easy Module to work with WhatPulse Client API.

Project description

# WhatPulse API Python Package This Package makes use of the WhatPulse Client API, making you able to easily use the API for any purpose (almost).

Introduction to the Package

  1. Setting the API up To set up the API, you need to download and use the WhatPulse Application on PC. Click on the Settings Tab, then Enable the Client API and choose a Port (or use the standard 3490 Port).

  2. Start Coding (Setting up API) First you have to import this Package, then define the API Object by calling the WhatPulse Class. Here you need the port you connect to, the retriever (more on that later) and if the Bot gets automatically set up (more on that later too)

import WhatPulseAPI as wp_api
my_api = wp_api.WhatPulse(<port>, <retriever>, <auto-setup?>)

Explanations (Docs)

Retrievers:

Retrievers are the last part of the URL to the API, usually the URL looks something like this: "http://localhost:3490/v1/account-totals". In this case "account-totals" is the retriever.

import WhatPulseAPI as wp_api
my_api = wp_api.WhatPulse(3490, "account-totals", True)

All Retrievers:

  • account-totals (shows your total stats)
  • realtime (shows stats per second e.g. Clicks Per Second)
  • unpulsed (reveals all unpulsed stats)
  • all-stats (all of the above)
  • profiles (returns all profiles)
  • pulse (pulses WhatPulse)
  • open-window (opens WhatPulse window)
  • profiles/activate (not implemented yet)

Auto-Setup:

Auto-Setup essentially automatically sends a request to the API as soon as you initialize the WhatPulse class. Meaning that this code would instantly open the WhatPulse window as soon as you run this program.

import WhatPulse_API as wp_api
my_api = wp_api.WhatPulse(3490, "open-window", True)

If you want to send a request later, then do this:

# Opens WhatPulses window after 5 seconds.
import WhatPulse_API as wp_api, time
my_api = wp_api.WhatPulse(3490, "open-window", True)

time.sleep(5)
my_api.setup_api()

return_all_keys_values()

The JSON File called by the API is essentially a bunch of tuples we can append all keys to one list and all the values to the corresponding keys in another list.

import WhatPulseAPI as wp_api
my_api = wp_api.WhatPulse(3490, "account-totals", True)
all_keys, all_values = my_api.return_all_keys_values()

print(all_keys, all_values)
> all_keys: ['clicks', 'clicks_formatted', 'distance_formatted', 'distance_miles', 'download', 'download_formatted', 'keys', 'keys_formatted', 'ranks', 'scrolls', 'scrolls_formatted', 'upload', 'upload_formatted', 'uptime', 'uptime_formatted']
> ['2311327', '2.311.327', '415km, 701m', '258.305', '2501209', '2,39TB', '6239937', '6.239.937', {'rank_clicks': '42866', 'rank_clicks_formatted': '42.866th', 'rank_distance': '3281', 'rank_distance_formatted': '3.281st', 'rank_download': '22213', 'rank_download_formatted': '22.213th', 'rank_keys': '30767', 'rank_keys_formatted': '30.767th', 'rank_scrolls': '5375', 'rank_scrolls_formatted': '5.375th', 'rank_upload': '16702', 'rank_upload_formatted': '16.702nd', 'rank_uptime': '60442', 'rank_uptime_formatted': '60.442nd'}, '1762076', '1.762.076', '577453', '563,92GB', '8971926', '103d, 20h, 12m']

return_value(key)

Returns the value to the corresponding key.

import WhatPulseAPI as wp_api 
my_api = wp_api.WhatPulse(3490, "account-totals", True) 
value = my_api.return_value('clicks')
print(value)

> 2311327

return_all_ranks()

Returns all ranks, one list for all the ranks that have not been formatted yet and one list for the formatted ranks as you can see here in the small code snippet.

import WhatPulseAPI as wp_api 
my_api = wp_api.WhatPulse(3490, "account-totals", True) 
all_ranks, all_ranks_formatted = my_api.return_all_ranks()

print(all_ranks[0], all_ranks_formatted[0])

> all_ranks[0] -> ('rank_clicks', '42866')
> all_ranks_formatted[0] -> ('ranks_clicks_formatted', '42.866th')

return_rank(key)

Returns the value to the corresponding rank-key.

import WhatPulseAPI as wp_api 
my_api = wp_api.WhatPulse(3490, "account-totals", True) 
value = my_api.return_rank('rank_clicks_formatted')
print(value)

> 42.866th
``

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whatpulse_api_py-0.2.5.2.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

WhatPulse_API_Py-0.2.5.2-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file whatpulse_api_py-0.2.5.2.tar.gz.

File metadata

  • Download URL: whatpulse_api_py-0.2.5.2.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for whatpulse_api_py-0.2.5.2.tar.gz
Algorithm Hash digest
SHA256 f56d2c22104f0322c6c1ea7b3032587b7606a70c2950aa8765e76e89e9ca4130
MD5 3327e30ba9f8f41a6db5289ce162e0c9
BLAKE2b-256 d065dfc5bd612921445a7b018bf1f0e4a00c5f625843fda9a9d0a0ebc3645d7b

See more details on using hashes here.

File details

Details for the file WhatPulse_API_Py-0.2.5.2-py3-none-any.whl.

File metadata

File hashes

Hashes for WhatPulse_API_Py-0.2.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 def53e69aa2f2ce58c1455a2a1c134077262aa151b754aae7af36c2a7ae3b788
MD5 5ba7912fa831261e13796149166590a2
BLAKE2b-256 4f9655ada962257bd28cbdd7cb5ea957184d5cc7e11818cbfdebcf1f5ac5501f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page