Unofficial API wrapper for https://ask.fm
Project description
askfm-api
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.
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.login("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
Related work / See also
- a similar library (currently outdated): https://github.com/Hexalyse/pyAskFm
- blog post with a more in-depth explanation of reverse-engineering ASKfm API: https://hexaly.se/2017/06/14/how-i-reverse-engineered-the-ask-fm-api-part-1/
Contributing
Any activity is welcome, but I would be especially grateful if someone wrote tests for this code.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file askfm-api-0.1.4.tar.gz
.
File metadata
- Download URL: askfm-api-0.1.4.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e0e3b1e1a9d346ad13e020a63e04b55d8cd5f454b92e494bc65ca7080b4b66b |
|
MD5 | 12eef664627e73fe59bc691666bb9101 |
|
BLAKE2b-256 | b0bcdfdbec3120917997eb4c452b7775f2ca6a6f073a2ccfe8a50a231d827258 |
File details
Details for the file askfm_api-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: askfm_api-0.1.4-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b627faecf6aa3574df645e12f2a3c9a2e4fac49cb6a48560aa0b451c0df829a |
|
MD5 | 2843bff1ef70f8fc7cd5cf243dd06b85 |
|
BLAKE2b-256 | d9ff07f5966801ecb237cea8ebb87cd70c422e35bdffb57d600dae803cb3b3de |