TonplaceApi - Ton.place api wrapper

Overview

tonplaceApi

ton.place/tonplaceApi

Обертка для ton.place

Установка

pip install https://github.com/kesha1225/tonplaceApi/archive/master.zip

Токен

Для работы вам понадобится токен, который можно получить вытащив с самого сайта из cookies или использовав token_helper:

import asyncio

from tonplace import get_token


async def main():
    token = await get_token("79123456789")  # Ваш номер от аккаунта в телеграме
    print(token)  # bxnjkfdh42fpFlX86CJetlbwPJfbTfcz11Y1y6Obqvf5mm86WFRl3D69


asyncio.get_event_loop().run_until_complete(main())

Примеры

Парсинг новых пользователей

import asyncio

from tonplace import get_token, API


async def main():
    token = await get_token("+79123456789")
    api = API(token)

    new_users = await api.search(tab="peoples", sort="new")
    for user_id, user_data in new_users["users"].items():
        print(user_data)

        user = await api.get_user(user_data["id"])
        # этот запрос возвращает данные которые уже есть в user_data, сделан просто для примера
        print(user)


asyncio.get_event_loop().run_until_complete(main())

Парсинг популярных групп, лайк, коммент, фолоу

import asyncio

from tonplace import get_token, API


async def main():
    token = await get_token("+79123456789")
    api = API(token)

    popular_groups = await api.search(tab="groups", sort="popular")
    for group_id in popular_groups["groups"]:
        group_data = await api.get_group(group_id)
        posts = group_data["posts"]
        target_post = posts[0]

        target_id = target_post["id"]
        await api.write_comment(target_id, text="test")
        await api.like(target_id)
        print(
            f"Написали коммент и лайкнули пост - https://ton.place/group{group_id}?w=post{target_id}"
        )

        post_author = target_post["ownerId"]
        await api.follow(post_author)
        print(f"Зафоловились на автора поста - https://ton.place/id{post_author}")


asyncio.get_event_loop().run_until_complete(main())
You might also like...
A Python API wrapper for the Twitter API!

PyTweet PyTweet is an api wrapper made for twitter using twitter's api version 2! Installation Windows py3 -m pip install PyTweet Linux python -m pip

Python API wrapper library for Convex Value API

convex-value-python Python API wrapper library for Convex Value API. Further Links: Convex Value homepage @ConvexValue on Twitter JB on Twitter Authen

An API wrapper around Discord API.

NeoCord This project is work in progress not for production use. An asynchronous API wrapper around Discord API written in Python. Features Modern API

This an API wrapper library for the OpenSea API written in Python 3.

OpenSea NFT API Python 3 wrapper This an API wrapper library for the OpenSea API written in Python 3. The library provides a simplified interface to f

YARSAW is an Async Python API Wrapper for the Random Stuff API.

Yet Another Random Stuff API Wrapper - YARSAW YARSAW is an Async Python API Wrapper for the Random Stuff API. This module makes it simpler for you to

A wrapper for The Movie Database API v3 and v4 that only uses the read access token (not api key).

fulltmdb A wrapper for The Movie Database API v3 and v4 that only uses the read access token (not api key). Installation Use the package manager pip t

EpikCord.py - This is an API Wrapper for Discord's API for Python

EpikCord.py - This is an API Wrapper for Discord's API for Python! We've decided not to fork discord.py and start completely from scratch for a new, better structuring system!

An API wrapper around the pythonanywhere's API.

pyaww An API wrapper around the pythonanywhere's API. The name stands for pythonanywherewrapper. 100% API coverage Most of the codebase is documented

A simple Python API wrapper for Cloudflare Stream's API.

python-cloudflare-stream A basic Python API wrapper for working with Cloudflare Stream. Arbington.com started off using Cloudflare Stream. We used the

Owner
Nickolay Samedov
Nickolay Samedov
🚀 An asynchronous python API wrapper meant to replace discord.py - Snappy discord api wrapper written with aiohttp & websockets

Pincer An asynchronous python API wrapper meant to replace discord.py ❗ The package is currently within the planning phase ?? Links |Join the discord

Pincer 125 Dec 26, 2022
Aws-lambda-requests-wrapper - Request/Response wrapper for AWS Lambda with API Gateway

AWS Lambda Requests Wrapper Request/Response wrapper for AWS Lambda with API Gat

null 1 May 20, 2022
A python package that allows you to place automated trades using the TD Ameritrade API.

Template Repo Table of Contents Overview Setup Usage Support These Projects Overview Setup Setup - Requirements Install:* For this particular project,

Alex Reed 4 Jan 25, 2022
PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

PRAW: The Python Reddit API Wrapper PRAW, an acronym for "Python Reddit API Wrapper", is a Python package that allows for simple access to Reddit's AP

Python Reddit API Wrapper Development 3k Dec 29, 2022
Python API wrapper around Trello's API

A wrapper around the Trello API written in Python. Each Trello object is represented by a corresponding Python object. The attributes of these objects

Richard Kolkovich 904 Jan 2, 2023
PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

PRAW: The Python Reddit API Wrapper PRAW, an acronym for "Python Reddit API Wrapper", is a Python package that allows for simple access to Reddit's AP

Python Reddit API Wrapper Development 3k Dec 29, 2022
An API wrapper around the pythonanywhere's API.

pyaww An API wrapper around the pythonanywhere's API. The name stands for pythonanywherewrapper. 100% api coverage most of the codebase is documented

null 7 Dec 11, 2022
Async ready API wrapper for Revolt API written in Python.

Mutiny Async ready API wrapper for Revolt API written in Python. Installation Python 3.9 or higher is required To install the library, you can just ru

null 16 Mar 29, 2022
An API Wrapper for Gofile API

Gofile2 from gofile2 import Gofile g_a = Gofile() print(g_a.upload(file="/home/itz-fork/photo.png")) An API Wrapper for Gofile API. About API Gofile

I'm Not A Bot #Left_TG 16 Dec 10, 2022
A simple API wrapper for the Tenor API

Gifpy A simple API wrapper for the Tenor API Installation Python 3.9 or higher is recommended python3 -m pip install gifpy Clone repository: $ git cl

Juan Ignacio Battiston 4 Dec 22, 2021