ogame stats
wrapper and logic around public game statistics for https://ogame.org
Some classes and methods to retrieve public data of the online game ogame.
This package is NOT intended to interact with an account - which is forbidden anyway.
Might be used to query the data sets, visualize results and generally to do data analysis.
requirements
depends on:
- python >= 3.6 (uses f-string)
- xmltodict as a convenience to convert XML data to more basic python types
- requests to perform http requests and
- pandas to perform queries on the data
installation
create your virtualenv with your preferred versionin a new directory
virtualenv -p python3.<6,7,8> venv
install the wrapper
pip install ogama_data_api
usage
basic usage
the most basic usage would look like.
#%%
import ogame_stats
#%% supply the two inputs to uniquely identify a universe
universe_id = 162
community = 'en'
#%% instantiate and thereby load the data
universe = ogame_stats.UniverseQuestions(universe_id, community)
than you could take a look at the data sets.
#%% get a list of all the planets
universe.universe
id player name coords
0 1 1 Arakis 1:1:2
... ... ... ... ...
[4378 rows x 4 columns]
#%% find some players
universe.players
id name status alliance
0 1 Legor a NaN
.. ... ... ... ...
[751 rows x 4 columns]
advanced usage
Now, data itself is nice. But lets ask it some questions. This is needs your help since asking the right questions is the key.
e.g. look up the planets of a user.
##%% get the coordinates and names of all the planets of a player
universe.get_planets_of_player('someSpecialName')
[{'coords': '1:45:4', 'name': 'MotherPlanet'},
{'coords': '1:144:2', 'name': 'ColonyC'},
{'coords': '1:145:3', 'name': 'ColonyB'},
{'coords': '1:303:5', 'name': 'ColonyA'},
{'coords': '5:119:9', 'name': 'ColonyE'},
{'coords': '1:289:9', 'name': 'ColonyD'},
{'coords': '1:389:9', 'name': 'ColonyF'}]
or ask for the status (active, inactive, banned, holiday etc.).
universe.get_player_status('someSpecialName')
'I'
or just dump everything about someSpecialName:
universe.get_player_data('someSpecialName')
get the complete list of players within a specific alliance
universe.get_players_of_alliance('someAlliance')
id name status alliance
291 103910 reabuilder NaN 500234
292 103930 1 4 Fun v 500234
312 104181 night owl NaN 500234
...
get to see the distribution of the planets owned by the alliance members.
universe.get_planets_distribution_by_galaxy('someAlliance')
{'1': 7, '2': 17, '3': 29, '4': 38, '5': 9, '6': 9, '7': 9, '8': 2, '9': 6}
Update frequencies of data
Don't spam the servers with requests. Since the data sets and classes avoid the usage of
XML attributes, it's easy to just pickle your UniverseData for tests, development and everything else.
These are the update frequencies I copied over at some point in time (might have changed):
players.xml -> daily
universe.xml -> weekly
highscore.xml -> hourly
alliances.xml -> daily
serverData.xml -> daily
playerData.xml -> weekly
localization.xml -> static
universes.xml -> static
Maybe the easiest way would be to use requests_cache.
import requests_cache
requests_cache.install_cache('demo_cache')
issues/ideas
... are generally welcome. saves us time. Also, the overall design is far from being ideal. Pull requests welcome. Be sure to include the tests.
Metadata
Release files for ogame-stats 0.3.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ogame_stats-0.3.6.tar.gz | 6.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ogame_stats-0.3.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.8 kB
Release files / ogame_stats-0.3.6.tar.gz
| Download URL | ogame_stats-0.3.6.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ad1d43c43fc9f4c719a0cef8991915f61017efee1be855dd971128e2a43a7efe
|
|
BLAKE2b-256 checksum How to use checksums |
9579062497ef16d5ec7b3f61a27b3d487ceae8f55edaa8f3b5ed6107e4481c0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
|
Release files / ogame_stats-0.3.6-py3-none-any.whl
| Download URL | ogame_stats-0.3.6-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c85c93f2ba69c0c3f6a555a9628c768a3b9b03098ee5ea5e8e122c02d2e07e40
|
|
BLAKE2b-256 checksum How to use checksums |
78db2701720999798f01147fb62f913f1d1acddaf0ac272cbc009628921ec649
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
|
Security for ogame-stats 0.3.6
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.