giftsniper 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- giftsniper-1.0.2/LICENSE +21 -0
- giftsniper-1.0.2/PKG-INFO +117 -0
- giftsniper-1.0.2/README.md +96 -0
- giftsniper-1.0.2/giftsniper.egg-info/PKG-INFO +117 -0
- giftsniper-1.0.2/giftsniper.egg-info/SOURCES.txt +9 -0
- giftsniper-1.0.2/giftsniper.egg-info/dependency_links.txt +1 -0
- giftsniper-1.0.2/giftsniper.egg-info/requires.txt +3 -0
- giftsniper-1.0.2/giftsniper.egg-info/top_level.txt +1 -0
- giftsniper-1.0.2/giftsniper.py +162 -0
- giftsniper-1.0.2/pyproject.toml +30 -0
- giftsniper-1.0.2/setup.cfg +4 -0
giftsniper-1.0.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GiftSniper
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: giftsniper
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: Python client for the GiftSniper API: Telegram NFT gifts data from Portals, MRKT, Telegram market, Fragment, Getgems
|
|
5
|
+
Author: GiftSniper
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://giftsniper.com/api
|
|
8
|
+
Project-URL: Documentation, https://giftsniper.com/api/docs?lang=en
|
|
9
|
+
Project-URL: Source, https://github.com/cryptonocry/giftsniper-api
|
|
10
|
+
Keywords: telegram,gifts,nft,ton,api,portals,mrkt,fragment,getgems
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Provides-Extra: stream
|
|
19
|
+
Requires-Dist: websockets; extra == "stream"
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# GiftSniper API — Telegram gifts data
|
|
23
|
+
|
|
24
|
+
Data on Telegram NFT gifts (collectible gifts) from **Portals, MRKT, the Telegram official market, Fragment, Getgems** and **Tonnel** (sales history; Tonnel closed on 25 Nov 2026) in one REST API, an MCP server for AI assistants and a one-file Python client.
|
|
25
|
+
|
|
26
|
+
- Plans and prices: https://giftsniper.com/api?lang=en
|
|
27
|
+
- Documentation (public, no payment needed to read): https://giftsniper.com/api/docs?lang=en
|
|
28
|
+
- What's new: https://giftsniper.com/api/docs?lang=en#changes
|
|
29
|
+
- OpenAPI spec: https://giftsniper.com/api/openapi.json
|
|
30
|
+
- MCP server: `https://giftsniper.com/api/mcp` (Streamable HTTP)
|
|
31
|
+
- Website: https://giftsniper.com
|
|
32
|
+
|
|
33
|
+
## What the data includes
|
|
34
|
+
|
|
35
|
+
- **Collections**: supply, listed, floors, sales and volume.
|
|
36
|
+
- **Floors** by market, model, backdrop and symbol, plus hourly floor history of each trait.
|
|
37
|
+
- **Sales history** since January 2025 (Telegram market since October 2026), per collection and per gift.
|
|
38
|
+
- **Listings** on all five live markets, with listing time and last price change.
|
|
39
|
+
- **Offers** for collections and traits (Portals, MRKT, Getgems).
|
|
40
|
+
- **Trading**: listing search across markets with the cheapest on each, deals below the next listing, cross-market spread, floors for a whole portfolio in one request.
|
|
41
|
+
- **Light analytics** (every plan): the whole market, market index, sales by day and month, top sales of the day, collection rankings with liquidity metrics, floor movers, traits with rarity, collection statistics, holders and their distribution, crafts and burns by day.
|
|
42
|
+
- **Pro analytics**: price candles, each market's floor over time, volume by model and backdrop, a person's gifts by @username with their value.
|
|
43
|
+
- **Webhooks** and a **WebSocket event stream**: new listings, price changes, sales and delistings.
|
|
44
|
+
|
|
45
|
+
## Plans (per month, paid in TON on the site, the key is issued at once)
|
|
46
|
+
|
|
47
|
+
| Plan | Price | Units | Requests per second |
|
|
48
|
+
|---|---|---|---|
|
|
49
|
+
| Trial (3 days) | $3 | 15,000 | 1 |
|
|
50
|
+
| Basic | $15 | 60,000 | 6 |
|
|
51
|
+
| Pro | $50 | 400,000 | 32 |
|
|
52
|
+
| Max | $100 | 1,200,000 | 55 |
|
|
53
|
+
| Stream | $200 | 3,000,000 | 75 |
|
|
54
|
+
|
|
55
|
+
Daily limits for each plan are listed before purchase: https://giftsniper.com/api?lang=en#limits. Extra units: 50,000 for $10 (Basic), $5 (Pro), $3.50 (Max), $2.50 (Stream).
|
|
56
|
+
|
|
57
|
+
## Quick start
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install giftsniper
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
curl -H "x-api-key: YOUR_KEY" "https://giftsniper.com/api/v1/floors?coll=pepe"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from giftsniper import GiftSniper
|
|
69
|
+
|
|
70
|
+
gs = GiftSniper("YOUR_KEY")
|
|
71
|
+
print(gs.floors("pepe")["floor"])
|
|
72
|
+
print(gs.deals("durovscap", min_discount=15)["deals"][:3])
|
|
73
|
+
print(gs.holders("pepe")["top_10_share_pct"])
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`giftsniper.py` is one file with no required dependencies (the event stream needs `pip install websockets`). The same file is served at https://giftsniper.com/vendor/giftsniper-1.0.2.py.
|
|
77
|
+
|
|
78
|
+
## MCP (Claude, ChatGPT, Cursor and other assistants)
|
|
79
|
+
|
|
80
|
+
Claude Code:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
claude mcp add --transport http giftsniper https://giftsniper.com/api/mcp --header "Authorization: Bearer YOUR_KEY"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Cursor, Claude Desktop and others:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"mcpServers": {
|
|
91
|
+
"giftsniper": {
|
|
92
|
+
"url": "https://giftsniper.com/api/mcp",
|
|
93
|
+
"headers": { "Authorization": "Bearer YOUR_KEY" }
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Every API request except webhooks and the stream is available as a tool. Units are spent as for normal requests.
|
|
100
|
+
|
|
101
|
+
## Data usage
|
|
102
|
+
|
|
103
|
+
Collecting data from giftsniper.com pages with programs (scraping), including through proxies, many accounts or bypassing protection, is not allowed. Apps, bots and AI services should use this API. Credit "Data by GiftSniper" with a link is welcome but not required. Full terms: https://giftsniper.com/api/docs?lang=en#terms
|
|
104
|
+
|
|
105
|
+
Support: [@giftsniper_contact](https://t.me/giftsniper_contact) in Telegram.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## По-русски
|
|
110
|
+
|
|
111
|
+
API подарков Telegram (NFT-подарки, гифты) с Portals, MRKT, маркета Telegram, Fragment, Getgems и Tonnel: коллекции, флоры, история продаж, лоты, офферы, торговые запросы, аналитика, webhooks и поток событий. Сервер MCP для ИИ-помощников и клиент на Python.
|
|
112
|
+
|
|
113
|
+
Тарифы и цены: https://giftsniper.com/api — документация открыта всем: https://giftsniper.com/api/docs
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
The Python client (`giftsniper.py`) is MIT-licensed. The data is provided under the terms above.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# GiftSniper API — Telegram gifts data
|
|
2
|
+
|
|
3
|
+
Data on Telegram NFT gifts (collectible gifts) from **Portals, MRKT, the Telegram official market, Fragment, Getgems** and **Tonnel** (sales history; Tonnel closed on 25 Nov 2026) in one REST API, an MCP server for AI assistants and a one-file Python client.
|
|
4
|
+
|
|
5
|
+
- Plans and prices: https://giftsniper.com/api?lang=en
|
|
6
|
+
- Documentation (public, no payment needed to read): https://giftsniper.com/api/docs?lang=en
|
|
7
|
+
- What's new: https://giftsniper.com/api/docs?lang=en#changes
|
|
8
|
+
- OpenAPI spec: https://giftsniper.com/api/openapi.json
|
|
9
|
+
- MCP server: `https://giftsniper.com/api/mcp` (Streamable HTTP)
|
|
10
|
+
- Website: https://giftsniper.com
|
|
11
|
+
|
|
12
|
+
## What the data includes
|
|
13
|
+
|
|
14
|
+
- **Collections**: supply, listed, floors, sales and volume.
|
|
15
|
+
- **Floors** by market, model, backdrop and symbol, plus hourly floor history of each trait.
|
|
16
|
+
- **Sales history** since January 2025 (Telegram market since October 2026), per collection and per gift.
|
|
17
|
+
- **Listings** on all five live markets, with listing time and last price change.
|
|
18
|
+
- **Offers** for collections and traits (Portals, MRKT, Getgems).
|
|
19
|
+
- **Trading**: listing search across markets with the cheapest on each, deals below the next listing, cross-market spread, floors for a whole portfolio in one request.
|
|
20
|
+
- **Light analytics** (every plan): the whole market, market index, sales by day and month, top sales of the day, collection rankings with liquidity metrics, floor movers, traits with rarity, collection statistics, holders and their distribution, crafts and burns by day.
|
|
21
|
+
- **Pro analytics**: price candles, each market's floor over time, volume by model and backdrop, a person's gifts by @username with their value.
|
|
22
|
+
- **Webhooks** and a **WebSocket event stream**: new listings, price changes, sales and delistings.
|
|
23
|
+
|
|
24
|
+
## Plans (per month, paid in TON on the site, the key is issued at once)
|
|
25
|
+
|
|
26
|
+
| Plan | Price | Units | Requests per second |
|
|
27
|
+
|---|---|---|---|
|
|
28
|
+
| Trial (3 days) | $3 | 15,000 | 1 |
|
|
29
|
+
| Basic | $15 | 60,000 | 6 |
|
|
30
|
+
| Pro | $50 | 400,000 | 32 |
|
|
31
|
+
| Max | $100 | 1,200,000 | 55 |
|
|
32
|
+
| Stream | $200 | 3,000,000 | 75 |
|
|
33
|
+
|
|
34
|
+
Daily limits for each plan are listed before purchase: https://giftsniper.com/api?lang=en#limits. Extra units: 50,000 for $10 (Basic), $5 (Pro), $3.50 (Max), $2.50 (Stream).
|
|
35
|
+
|
|
36
|
+
## Quick start
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install giftsniper
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
curl -H "x-api-key: YOUR_KEY" "https://giftsniper.com/api/v1/floors?coll=pepe"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from giftsniper import GiftSniper
|
|
48
|
+
|
|
49
|
+
gs = GiftSniper("YOUR_KEY")
|
|
50
|
+
print(gs.floors("pepe")["floor"])
|
|
51
|
+
print(gs.deals("durovscap", min_discount=15)["deals"][:3])
|
|
52
|
+
print(gs.holders("pepe")["top_10_share_pct"])
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`giftsniper.py` is one file with no required dependencies (the event stream needs `pip install websockets`). The same file is served at https://giftsniper.com/vendor/giftsniper-1.0.2.py.
|
|
56
|
+
|
|
57
|
+
## MCP (Claude, ChatGPT, Cursor and other assistants)
|
|
58
|
+
|
|
59
|
+
Claude Code:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
claude mcp add --transport http giftsniper https://giftsniper.com/api/mcp --header "Authorization: Bearer YOUR_KEY"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Cursor, Claude Desktop and others:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mcpServers": {
|
|
70
|
+
"giftsniper": {
|
|
71
|
+
"url": "https://giftsniper.com/api/mcp",
|
|
72
|
+
"headers": { "Authorization": "Bearer YOUR_KEY" }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Every API request except webhooks and the stream is available as a tool. Units are spent as for normal requests.
|
|
79
|
+
|
|
80
|
+
## Data usage
|
|
81
|
+
|
|
82
|
+
Collecting data from giftsniper.com pages with programs (scraping), including through proxies, many accounts or bypassing protection, is not allowed. Apps, bots and AI services should use this API. Credit "Data by GiftSniper" with a link is welcome but not required. Full terms: https://giftsniper.com/api/docs?lang=en#terms
|
|
83
|
+
|
|
84
|
+
Support: [@giftsniper_contact](https://t.me/giftsniper_contact) in Telegram.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## По-русски
|
|
89
|
+
|
|
90
|
+
API подарков Telegram (NFT-подарки, гифты) с Portals, MRKT, маркета Telegram, Fragment, Getgems и Tonnel: коллекции, флоры, история продаж, лоты, офферы, торговые запросы, аналитика, webhooks и поток событий. Сервер MCP для ИИ-помощников и клиент на Python.
|
|
91
|
+
|
|
92
|
+
Тарифы и цены: https://giftsniper.com/api — документация открыта всем: https://giftsniper.com/api/docs
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
The Python client (`giftsniper.py`) is MIT-licensed. The data is provided under the terms above.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: giftsniper
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: Python client for the GiftSniper API: Telegram NFT gifts data from Portals, MRKT, Telegram market, Fragment, Getgems
|
|
5
|
+
Author: GiftSniper
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://giftsniper.com/api
|
|
8
|
+
Project-URL: Documentation, https://giftsniper.com/api/docs?lang=en
|
|
9
|
+
Project-URL: Source, https://github.com/cryptonocry/giftsniper-api
|
|
10
|
+
Keywords: telegram,gifts,nft,ton,api,portals,mrkt,fragment,getgems
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Provides-Extra: stream
|
|
19
|
+
Requires-Dist: websockets; extra == "stream"
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# GiftSniper API — Telegram gifts data
|
|
23
|
+
|
|
24
|
+
Data on Telegram NFT gifts (collectible gifts) from **Portals, MRKT, the Telegram official market, Fragment, Getgems** and **Tonnel** (sales history; Tonnel closed on 25 Nov 2026) in one REST API, an MCP server for AI assistants and a one-file Python client.
|
|
25
|
+
|
|
26
|
+
- Plans and prices: https://giftsniper.com/api?lang=en
|
|
27
|
+
- Documentation (public, no payment needed to read): https://giftsniper.com/api/docs?lang=en
|
|
28
|
+
- What's new: https://giftsniper.com/api/docs?lang=en#changes
|
|
29
|
+
- OpenAPI spec: https://giftsniper.com/api/openapi.json
|
|
30
|
+
- MCP server: `https://giftsniper.com/api/mcp` (Streamable HTTP)
|
|
31
|
+
- Website: https://giftsniper.com
|
|
32
|
+
|
|
33
|
+
## What the data includes
|
|
34
|
+
|
|
35
|
+
- **Collections**: supply, listed, floors, sales and volume.
|
|
36
|
+
- **Floors** by market, model, backdrop and symbol, plus hourly floor history of each trait.
|
|
37
|
+
- **Sales history** since January 2025 (Telegram market since October 2026), per collection and per gift.
|
|
38
|
+
- **Listings** on all five live markets, with listing time and last price change.
|
|
39
|
+
- **Offers** for collections and traits (Portals, MRKT, Getgems).
|
|
40
|
+
- **Trading**: listing search across markets with the cheapest on each, deals below the next listing, cross-market spread, floors for a whole portfolio in one request.
|
|
41
|
+
- **Light analytics** (every plan): the whole market, market index, sales by day and month, top sales of the day, collection rankings with liquidity metrics, floor movers, traits with rarity, collection statistics, holders and their distribution, crafts and burns by day.
|
|
42
|
+
- **Pro analytics**: price candles, each market's floor over time, volume by model and backdrop, a person's gifts by @username with their value.
|
|
43
|
+
- **Webhooks** and a **WebSocket event stream**: new listings, price changes, sales and delistings.
|
|
44
|
+
|
|
45
|
+
## Plans (per month, paid in TON on the site, the key is issued at once)
|
|
46
|
+
|
|
47
|
+
| Plan | Price | Units | Requests per second |
|
|
48
|
+
|---|---|---|---|
|
|
49
|
+
| Trial (3 days) | $3 | 15,000 | 1 |
|
|
50
|
+
| Basic | $15 | 60,000 | 6 |
|
|
51
|
+
| Pro | $50 | 400,000 | 32 |
|
|
52
|
+
| Max | $100 | 1,200,000 | 55 |
|
|
53
|
+
| Stream | $200 | 3,000,000 | 75 |
|
|
54
|
+
|
|
55
|
+
Daily limits for each plan are listed before purchase: https://giftsniper.com/api?lang=en#limits. Extra units: 50,000 for $10 (Basic), $5 (Pro), $3.50 (Max), $2.50 (Stream).
|
|
56
|
+
|
|
57
|
+
## Quick start
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install giftsniper
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
curl -H "x-api-key: YOUR_KEY" "https://giftsniper.com/api/v1/floors?coll=pepe"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from giftsniper import GiftSniper
|
|
69
|
+
|
|
70
|
+
gs = GiftSniper("YOUR_KEY")
|
|
71
|
+
print(gs.floors("pepe")["floor"])
|
|
72
|
+
print(gs.deals("durovscap", min_discount=15)["deals"][:3])
|
|
73
|
+
print(gs.holders("pepe")["top_10_share_pct"])
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`giftsniper.py` is one file with no required dependencies (the event stream needs `pip install websockets`). The same file is served at https://giftsniper.com/vendor/giftsniper-1.0.2.py.
|
|
77
|
+
|
|
78
|
+
## MCP (Claude, ChatGPT, Cursor and other assistants)
|
|
79
|
+
|
|
80
|
+
Claude Code:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
claude mcp add --transport http giftsniper https://giftsniper.com/api/mcp --header "Authorization: Bearer YOUR_KEY"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Cursor, Claude Desktop and others:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"mcpServers": {
|
|
91
|
+
"giftsniper": {
|
|
92
|
+
"url": "https://giftsniper.com/api/mcp",
|
|
93
|
+
"headers": { "Authorization": "Bearer YOUR_KEY" }
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Every API request except webhooks and the stream is available as a tool. Units are spent as for normal requests.
|
|
100
|
+
|
|
101
|
+
## Data usage
|
|
102
|
+
|
|
103
|
+
Collecting data from giftsniper.com pages with programs (scraping), including through proxies, many accounts or bypassing protection, is not allowed. Apps, bots and AI services should use this API. Credit "Data by GiftSniper" with a link is welcome but not required. Full terms: https://giftsniper.com/api/docs?lang=en#terms
|
|
104
|
+
|
|
105
|
+
Support: [@giftsniper_contact](https://t.me/giftsniper_contact) in Telegram.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## По-русски
|
|
110
|
+
|
|
111
|
+
API подарков Telegram (NFT-подарки, гифты) с Portals, MRKT, маркета Telegram, Fragment, Getgems и Tonnel: коллекции, флоры, история продаж, лоты, офферы, торговые запросы, аналитика, webhooks и поток событий. Сервер MCP для ИИ-помощников и клиент на Python.
|
|
112
|
+
|
|
113
|
+
Тарифы и цены: https://giftsniper.com/api — документация открыта всем: https://giftsniper.com/api/docs
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
The Python client (`giftsniper.py`) is MIT-licensed. The data is provided under the terms above.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
giftsniper
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"""GiftSniper API client for Python — Telegram gifts data (floors, listings, sales history, offers, analytics, webhooks, stream).
|
|
2
|
+
|
|
3
|
+
Docs: https://giftsniper.com/api/docs?lang=en Plans and keys: https://giftsniper.com/api?lang=en
|
|
4
|
+
|
|
5
|
+
from giftsniper import GiftSniper
|
|
6
|
+
gs = GiftSniper("gsk_...")
|
|
7
|
+
print(gs.floors("pepe")["floor"])
|
|
8
|
+
for page in gs.sales_pages("pepe", max_pages=3):
|
|
9
|
+
print(len(page["sales"]))
|
|
10
|
+
|
|
11
|
+
One file, no required dependencies (uses the standard library). The stream needs `pip install websockets`.
|
|
12
|
+
Version 1.0.2 (2026-12-02). License: MIT.
|
|
13
|
+
"""
|
|
14
|
+
import hashlib
|
|
15
|
+
import hmac
|
|
16
|
+
import json
|
|
17
|
+
import time
|
|
18
|
+
import urllib.error
|
|
19
|
+
import urllib.parse
|
|
20
|
+
import urllib.request
|
|
21
|
+
|
|
22
|
+
__version__ = "1.0.2"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class _NoRedirect(urllib.request.HTTPRedirectHandler):
|
|
26
|
+
"""The key must never follow a redirect to another address."""
|
|
27
|
+
|
|
28
|
+
def redirect_request(self, req, fp, code, msg, headers, newurl):
|
|
29
|
+
raise urllib.error.HTTPError(req.full_url, code, f"redirect to {newurl} refused", headers, fp)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
_OPEN = urllib.request.build_opener(_NoRedirect).open
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _err_body(e):
|
|
36
|
+
try:
|
|
37
|
+
return (json.load(e) or {}).get("error") or {}
|
|
38
|
+
except ValueError:
|
|
39
|
+
return {}
|
|
40
|
+
BASE = "https://giftsniper.com/api/v1"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class GiftSniperError(Exception):
|
|
44
|
+
"""API answered with an error: .status (HTTP code), .code (e.g. "units", "plan", "rate"), .message."""
|
|
45
|
+
|
|
46
|
+
def __init__(self, status, code, message):
|
|
47
|
+
super().__init__(f"{status} {code}: {message}")
|
|
48
|
+
self.status, self.code, self.message = status, code, message
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class GiftSniper:
|
|
52
|
+
"""Client. retries — how many times to retry 429 rate / 503 busy (waits as the server asks)."""
|
|
53
|
+
|
|
54
|
+
def __init__(self, key, base=BASE, timeout=60, retries=3):
|
|
55
|
+
if not str(base).startswith("https://"):
|
|
56
|
+
raise ValueError("base must start with https://")
|
|
57
|
+
self.key, self.base, self.timeout, self.retries = key, base.rstrip("/"), timeout, retries
|
|
58
|
+
self.units_left = None # from the last response header x-units-left
|
|
59
|
+
|
|
60
|
+
def get(self, path, **params):
|
|
61
|
+
q = {k: (",".join(v) if isinstance(v, (list, tuple, set)) else v) for k, v in params.items() if v is not None}
|
|
62
|
+
url = f"{self.base}/{path.lstrip('/')}" + (f"?{urllib.parse.urlencode(q)}" if q else "")
|
|
63
|
+
for attempt in range(self.retries + 1):
|
|
64
|
+
req = urllib.request.Request(url, headers={"x-api-key": self.key, "user-agent": f"giftsniper-python/{__version__}"})
|
|
65
|
+
try:
|
|
66
|
+
with _OPEN(req, timeout=self.timeout) as r:
|
|
67
|
+
self.units_left = int(r.headers.get("x-units-left") or 0) if r.headers.get("x-units-left") else self.units_left
|
|
68
|
+
return json.load(r)
|
|
69
|
+
except urllib.error.HTTPError as e:
|
|
70
|
+
err = _err_body(e)
|
|
71
|
+
retry = e.code == 503 or (e.code == 429 and err.get("code") == "rate")
|
|
72
|
+
if retry and attempt < self.retries:
|
|
73
|
+
try:
|
|
74
|
+
wait = float(e.headers.get("retry-after") or 1 + attempt)
|
|
75
|
+
except ValueError:
|
|
76
|
+
wait = 1 + attempt
|
|
77
|
+
time.sleep(min(wait, 60))
|
|
78
|
+
continue
|
|
79
|
+
raise GiftSniperError(e.code, err.get("code", "error"), err.get("message", str(e))) from None
|
|
80
|
+
raise GiftSniperError(503, "busy", "retries exhausted")
|
|
81
|
+
|
|
82
|
+
# ---- account and catalog
|
|
83
|
+
def me(self): return self.get("me")
|
|
84
|
+
def collections(self): return self.get("collections")
|
|
85
|
+
|
|
86
|
+
# ---- prices
|
|
87
|
+
def floors(self, coll): return self.get("floors", coll=coll)
|
|
88
|
+
def floor_history(self, coll, trait, name, range="7d"): return self.get("floors/history", coll=coll, trait=trait, name=name, range=range)
|
|
89
|
+
def floors_resolve(self, items):
|
|
90
|
+
"""items: [("pepe", "Pink Galaxy", "Black"), ("pepe", "Pink Galaxy"), ("mythmask",)] — floor per item and the total."""
|
|
91
|
+
return self.get("floors/resolve", items="|".join(":".join(x) for x in items))
|
|
92
|
+
def floors_markets(self, coll, period="7d"): return self.get("floors/markets", coll=coll, period=period)
|
|
93
|
+
|
|
94
|
+
# ---- listings and trading
|
|
95
|
+
def lots(self, coll): return self.get("lots", coll=coll)
|
|
96
|
+
def search(self, coll, models=None, backdrops=None, symbols=None, markets=None, price_min=None, price_max=None, sort="price", limit=100):
|
|
97
|
+
return self.get("search", coll=coll, models=models, backdrops=backdrops, symbols=symbols, markets=markets, price_min=price_min, price_max=price_max, sort=sort, limit=limit)
|
|
98
|
+
def deals(self, coll, min_discount=10): return self.get("deals", coll=coll, min_discount=min_discount)
|
|
99
|
+
def spread(self, coll): return self.get("spread", coll=coll)
|
|
100
|
+
def offers(self, coll): return self.get("offers", coll=coll)
|
|
101
|
+
|
|
102
|
+
# ---- sales history
|
|
103
|
+
def sales(self, coll, before=None): return self.get("sales", coll=coll, before=before)
|
|
104
|
+
def sales_pages(self, coll, before=None, max_pages=None):
|
|
105
|
+
"""Yields pages newest first until the history ends (or max_pages). Older pages cost more units: see the docs."""
|
|
106
|
+
n = 0
|
|
107
|
+
while True:
|
|
108
|
+
page = self.sales(coll, before)
|
|
109
|
+
yield page
|
|
110
|
+
n += 1
|
|
111
|
+
before = page.get("next_before")
|
|
112
|
+
if not before or (max_pages and n >= max_pages):
|
|
113
|
+
return
|
|
114
|
+
def gift(self, coll, n, full=False): return self.get("gift", coll=coll, n=n, full=1 if full else None)
|
|
115
|
+
def profile(self, username): return self.get("profile", u=username.lstrip("@"))
|
|
116
|
+
|
|
117
|
+
# ---- analytics
|
|
118
|
+
def market(self): return self.get("market")
|
|
119
|
+
def market_daily(self): return self.get("market/daily")
|
|
120
|
+
def index(self): return self.get("index")
|
|
121
|
+
def rankings(self, sort="market_cap", order="desc"): return self.get("rankings", sort=sort, order=order)
|
|
122
|
+
def movers(self, period="7d"): return self.get("movers", period=period)
|
|
123
|
+
def traits(self, coll): return self.get("traits", coll=coll)
|
|
124
|
+
def stats(self, coll): return self.get("stats", coll=coll)
|
|
125
|
+
def holders(self, coll): return self.get("holders", coll=coll)
|
|
126
|
+
def crafts(self, coll): return self.get("crafts", coll=coll)
|
|
127
|
+
def market_top(self): return self.get("market/top")
|
|
128
|
+
def candles(self, coll, range="7d"): return self.get("candles", coll=coll, range=range)
|
|
129
|
+
def volume_traits(self, coll, by="model", period="7d"): return self.get("volume/traits", coll=coll, by=by, period=period)
|
|
130
|
+
|
|
131
|
+
# ---- webhooks (Max and Stream)
|
|
132
|
+
def _send(self, method, path, body=None, **params):
|
|
133
|
+
q = f"?{urllib.parse.urlencode(params)}" if params else ""
|
|
134
|
+
req = urllib.request.Request(f"{self.base}/{path}{q}", method=method, data=json.dumps(body).encode() if body is not None else None,
|
|
135
|
+
headers={"x-api-key": self.key, "content-type": "application/json", "user-agent": f"giftsniper-python/{__version__}"})
|
|
136
|
+
try:
|
|
137
|
+
with _OPEN(req, timeout=self.timeout) as r:
|
|
138
|
+
return json.load(r)
|
|
139
|
+
except urllib.error.HTTPError as e:
|
|
140
|
+
err = _err_body(e)
|
|
141
|
+
raise GiftSniperError(e.code, err.get("code", "error"), err.get("message", str(e))) from None
|
|
142
|
+
def webhooks(self): return self.get("webhooks")
|
|
143
|
+
def webhook_create(self, url, **filters): return self._send("POST", "webhooks", {"url": url, **filters})
|
|
144
|
+
def webhook_update(self, hook_id, **fields): return self._send("POST", "webhooks", {"id": hook_id, **fields})
|
|
145
|
+
def webhook_delete(self, hook_id): return self._send("DELETE", "webhooks", id=hook_id)
|
|
146
|
+
|
|
147
|
+
# ---- stream (Stream plan): async generator of events
|
|
148
|
+
async def stream(self, **filters):
|
|
149
|
+
"""async for ev in gs.stream(colls=["pepe"], types=["list", "price_down"]): ... Needs `pip install websockets`."""
|
|
150
|
+
import websockets
|
|
151
|
+
q = urllib.parse.urlencode({k: ",".join(v) if isinstance(v, (list, tuple)) else v for k, v in filters.items() if v is not None})
|
|
152
|
+
url = "wss://giftsniper.com/api/v1/stream" + (f"?{q}" if q else "")
|
|
153
|
+
async with websockets.connect(url, additional_headers={"x-api-key": self.key}, max_size=2 ** 22) as ws:
|
|
154
|
+
async for msg in ws:
|
|
155
|
+
yield json.loads(msg)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def verify_webhook(secret, raw_body, signature):
|
|
159
|
+
"""True if X-GS-Signature matches the raw request body (bytes) for this webhook secret.
|
|
160
|
+
Signatures cover the body only: also drop repeats by event id / time on your side (a captured request could be resent)."""
|
|
161
|
+
good = hmac.new(secret.encode(), raw_body if isinstance(raw_body, bytes) else raw_body.encode(), hashlib.sha256).hexdigest()
|
|
162
|
+
return hmac.compare_digest(good.encode(), str(signature or "").encode("utf-8", "replace"))
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "giftsniper"
|
|
7
|
+
version = "1.0.2"
|
|
8
|
+
description = "Python client for the GiftSniper API: Telegram NFT gifts data from Portals, MRKT, Telegram market, Fragment, Getgems"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
authors = [{ name = "GiftSniper" }]
|
|
12
|
+
requires-python = ">=3.8"
|
|
13
|
+
keywords = ["telegram", "gifts", "nft", "ton", "api", "portals", "mrkt", "fragment", "getgems"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
stream = ["websockets"]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Homepage = "https://giftsniper.com/api"
|
|
26
|
+
Documentation = "https://giftsniper.com/api/docs?lang=en"
|
|
27
|
+
Source = "https://github.com/cryptonocry/giftsniper-api"
|
|
28
|
+
|
|
29
|
+
[tool.setuptools]
|
|
30
|
+
py-modules = ["giftsniper"]
|