Skip to main content

askfm-api

PyPI version PyPI status Code style: black Project manager: pdm

This aims to be a powerful Python wrapper around the undocumented ASKfm API for its mobile apps.

Currently based on reverse-engineering ASKfm Android app v4.67.1, which uses ASKfm API version 1.18. The core logic is quite complete, but only a small subset of API methods have helpers in the askfm_api.requests module so far.

Feature highlights

  • iterators for paginated requests
  • full error hierarchy based on semantics
  • automatic session refreshing

Usage

The code should be self-explanatory so I won't go into great detail here. Quick example:

from askfm_api import AskfmApi, AskfmApiError
from askfm_api import requests as r

try:
    api = AskfmApi("<secret key>", device_id="D2A6C471C4B4DA5C")
    me = api.log_in("username", "password")
    print(me)
    # {'uid': 'jgrdlgrd', 'fullName': 'Снег не растает', 'location': 'my empire of dirt', ...}

    qs = api.request_iter(r.fetch_questions())
    print(next(qs))
    # {'type': 'daily', 'body': 'Hi?', 'answer': None, 'author': None, 'qid': 153352, ...}

    res = api.request(
        r.post_answer(question_type="daily", question_id=153352, text="Hi there!")
    )
    print(res)
    # {'question': {...}, 'answer': {...}}
except AskfmApiError as e:
    print(e)
    # error code returned by the API, e. g. 'session_expired'

Signing key

All requests are signed using a secret key (unique per app version) that is stored inside the official app in an obfuscated manner. I don't find it ethical to publish it, so if you want to use this library, your options are:

  • extract the key by yourself
  • contact me, explain your use case and ask for the key

Todo

  • feat: Add more method helpers
  • tests: Add tests

Contributing

Any activity is welcome, but I would be especially grateful if someone wrote tests for this code.

Metadata

Release files for askfm-api 0.2.1

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

Source distribution (sdist)

Source distribution for askfm-api 0.2.1
File Size Uploaded Provenance Actions
askfm-api-0.2.1.tar.gz 7.7 kB Without provenance Details for askfm-api-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for askfm-api 0.2.1
File Interpreter ABI Platform Actions
askfm_api-0.2.1-py3-none-any.whl Python 3 none any Details for askfm_api-0.2.1-py3-none-any.whl

Total release size: 16.1 kB

Release files / askfm-api-0.2.1.tar.gz

Download URL askfm-api-0.2.1.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
87a63ae3a7ef59d5fb0b0f371f85f4be8f07b5d8cd1502dbb6ffab73f8d87ee0
BLAKE2b-256 checksum
How to use checksums
82631666638ddf892883aac15b2f077947d8bfbe2c3a53b072f5086ea3aab21e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

Release files / askfm_api-0.2.1-py3-none-any.whl

Download URL askfm_api-0.2.1-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ffb8674db2b581183a03044bb2de375a6b789759c82726e93ad9ec4b26cd72a
BLAKE2b-256 checksum
How to use checksums
e9dbcba2a4caa33aa03fea73111c0f9778973fcaa154ccfe4af5b67916db19d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

Security for askfm-api 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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