Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
c1e073a
*: temporarily make rewrite files
null8626 Sep 28, 2024
75ef83b
fix: forgot to make this None
null8626 Sep 28, 2024
9d26c54
meta: update project metadata
null8626 Sep 28, 2024
f4ff2e9
refactor: explicitly type __slots__
null8626 Sep 28, 2024
7f93a7b
feat: add error classes
null8626 Sep 29, 2024
fc0ecae
refactor: add __own_session checks
null8626 Sep 29, 2024
33210d3
refactor: make source not read-only [skip ci]
null8626 Sep 30, 2024
a240695
deps: bump minimum aiohttp version to version 3.10.8
null8626 Sep 30, 2024
64bab99
refactor: type everything [skip ci]
null8626 Sep 30, 2024
161e85d
meta: add support for python 3.13
null8626 Oct 8, 2024
2abeb40
feat: add ratelimit checking
null8626 Oct 13, 2024
c2bfb24
feat: improve properties of error classes
null8626 Oct 13, 2024
69c0de8
feat: add get_bot
null8626 Oct 13, 2024
1fdf7c4
feat: handle avatars
null8626 Oct 13, 2024
543bf95
refactor: add return types
null8626 Oct 14, 2024
6d93c40
doc: documentation tweaks
null8626 Oct 14, 2024
c67bac9
feat: add documentation
null8626 Oct 14, 2024
da84e15
style: prettier
null8626 Oct 14, 2024
fbd9148
doc: documentation tweaks
null8626 Oct 14, 2024
bf990bb
fix: fix datetime errors
null8626 Oct 15, 2024
1034564
feat: update properties of the Bot class
null8626 Oct 16, 2024
91deca2
feat: rename timestamp to updated_at
null8626 Oct 16, 2024
6d84bc4
feat: add support for historical bot entries
null8626 Oct 16, 2024
4f271d8
refactor: use __slots__ instead
null8626 Oct 16, 2024
16d65c1
refactor: remove unnecessary copy-pasted classes
null8626 Oct 16, 2024
ed0f57e
refactor: make use of the walrus operator
null8626 Oct 16, 2024
b4310a2
fix: forgot to remove this
null8626 Oct 16, 2024
1d07c14
style: change strftime format
null8626 Oct 16, 2024
15a0aa6
fix: fix wrong kind
null8626 Oct 16, 2024
bffcb97
style: forgot to add typings
null8626 Oct 16, 2024
2703dda
feat: add MANIFEST.in
null8626 Oct 16, 2024
56796ba
fix: strptime does not accept timezone kwargs
null8626 Oct 16, 2024
239dfbb
refactor: tweaks for historical entry queries
null8626 Oct 16, 2024
3d05bb9
doc: make this even more clear
null8626 Oct 16, 2024
d18284f
feat: update bot object to reflect the new updates
null8626 Oct 19, 2024
c997d29
refactor: use fromisoformat instead of strptime
null8626 Oct 19, 2024
4551efa
feat: rename properties and methods
null8626 Oct 19, 2024
be2df33
doc: add support server link
null8626 Oct 19, 2024
9d27fc2
feat: cover pretty much everything
null8626 Oct 19, 2024
dc8e17c
doc: these classes don't have a parent class
null8626 Oct 19, 2024
ea95c88
refactor: use fromisoformat instead of strptime
null8626 Oct 19, 2024
d5af0b1
doc: documentation tweaks
null8626 Oct 19, 2024
752b469
refactor: screw nullable checks
null8626 Oct 19, 2024
3f05c7b
refactor: use unix_timestamp instead of isoformat
null8626 Oct 20, 2024
a6024f8
doc: reword documentation
null8626 Oct 19, 2024
0fe4a88
fix: use the statusCode key instead of code
null8626 Oct 20, 2024
8b8dd31
fix: use the expiredIn key
null8626 Oct 20, 2024
92fd60c
fix: add None checking
null8626 Oct 20, 2024
b3b76b7
feat: add more features to adapt to the new API changes
null8626 Oct 23, 2024
1f7e09a
refactor: some feature tweaks
null8626 Oct 23, 2024
4988efa
doc: fix documentation python class hyperlinks
null8626 Oct 24, 2024
7949af2
feat: add more headers
null8626 Oct 28, 2024
394e1eb
feat: add get_users_bot
null8626 Oct 29, 2024
1f15e12
refactor: remove unnecessary self.__class__
null8626 Nov 6, 2024
b449caf
fix: make the minimum possible limit 1 instead of 100
null8626 Nov 6, 2024
d38a4ce
feat: adapt to the new API changes
null8626 Nov 24, 2024
18b0e5d
deps: bump aiohttp version to 3.11.7
null8626 Nov 27, 2024
20e8ff8
feat: add support for the compare endpoints
null8626 Nov 27, 2024
ca9a1b1
doc: add readme
null8626 Nov 27, 2024
54accaf
refactor: change return types for the comparison methods
null8626 Nov 27, 2024
98eb9ed
doc: show this off too
null8626 Nov 27, 2024
86ebf48
fix: fix issue with duplicate bot IDs
null8626 Nov 28, 2024
859f274
refactor: fuck it make everything an iterable
null8626 Nov 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* eol=lf
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.idea/
**/__pycache__/
topstats.egg-info/
docs/_build/
dist/
dblstats/__pycache__/
dblstats/objects/__pycache__/
dblstats/utils/__pycache__/
.ruff_cache/
.vscode/
14 changes: 0 additions & 14 deletions .readthedocs.yml

This file was deleted.

3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License
The MIT License (MIT)

Copyright (c) 2020 Arthurdw
Copyright (c) 2024 null8626

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 0 additions & 18 deletions MANIFEST

This file was deleted.

7 changes: 7 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
prune .ruff_cache
prune docs
exclude .gitattributes
exclude .gitignore
exclude .readthedocs.yml
exclude ruff.toml
exclude LICENSE
116 changes: 63 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,63 @@
# dblstats

An easy to use async [dblstatistics.com](https://dblstatistics.com) API wrapper.

### README information

#### Command execution

When commands that need to be executed are shown in this documentation,
optional command will be surrounded by brackets.

#### System specific command execution

Since python has a different command call on Linus and Windows we specify both
in the documentation.
```
documentation: (py -3 | python3) command
windows: py -3 command
linux: python3 command
```

## Installing

To install the library you can just run the following pip command.
```
(py -3 -m | python3 -m) pip install dblstats
```

## Executing example scripts

### Requirements

The example scripts might be discord bots.
If so execute the following command to install the dependencies.

```
(py -3 -m | python3 -m) pip install utilsx
```

### Running

To execute the example scripts that are located in `examples` just execute
the following command.

```
(py -3 | python3) script_name.py
```

## Links

* [Documentation](https://official-dblstats.readthedocs.io/en/latest/)
* [dblstatistics.com Discord Sever](https://discord.gg/Qd34uz7qDY)
* [dblstatistics.com documentation](https://dblstatistics.com/api/docs)
# [topstats][pypi-url] [![pypi][pypi-image]][pypi-url] [![downloads][downloads-image]][pypi-url]

[pypi-image]: https://img.shields.io/pypi/v/topstats.svg?style=flat-square
[pypi-url]: https://pypi.org/project/topstats/
[downloads-image]: https://img.shields.io/pypi/dm/topstats?style=flat-square

The official Python API wrapper for [topstats.gg](https://topstats.gg).

## Installation

```console
pip install topstats
```

## Example

```py
# import the module
import topstats

import asyncio
import os

async def main() -> None:
# declare the client. the measuring unit used defaults to the metric system (celcius, km/h, etc.)
async with topstats.Client('your topstats.gg API token') as ts:
# fetch a ranked bot from its bot ID
bot = await ts.get(432610292342587392)

print(bot)

# fetch topstats.gg's top bots
bots = await ts.get_top_bots(sort_by=topstats.SortBy.server_count())

for b in bots:
print(b)

# compare two bots' historical server count
vs = await ts.compare_bot_server_count(432610292342587392, 437808476106784770)

for first, second in vs:
print(first, second)

# compare up to four bots' historical total votes
vs2 = await ts.compare_bot_total_votes(
topstats.Period.LAST_YEAR,
339254240012664832,
432610292342587392,
408785106942164992,
437808476106784770
)

for first, second, third, fourth in vs2:
print(first, second, third, fourth)

if __name__ == '__main__':
# see https://stackoverflow.com/questions/45600579/asyncio-event-loop-is-closed-when-getting-loop
# for more details
if os.name == 'nt':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

asyncio.run(main())
```
67 changes: 0 additions & 67 deletions README.rst

This file was deleted.

25 changes: 0 additions & 25 deletions dblstats/__init__.py

This file was deleted.

22 changes: 0 additions & 22 deletions dblstats/objects/__init__.py

This file was deleted.

Loading