Skip to content

Commit 8417453

Browse files
committed
Additional fixes from testing and documentation updates
1 parent ce960be commit 8417453

File tree

3 files changed

+248
-106
lines changed

3 files changed

+248
-106
lines changed

README.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,64 +4,61 @@ This is an unofficial client for the [Screeps](https://screeps.com/) Unoffical A
44

55
Since the API is unofficial it could in theory change at any time. In practice though breaking changes are rare.
66

7+
## Setup
78

8-
## Setup:
9-
10-
Simply install the library using `pip`.
11-
9+
Simply install the Python `screepsapi` library using `pip`.
1210

1311
## Usage
1412

1513
### Authentication
1614

17-
To authenticate to the primary servers just supply a username and password.
15+
The recommended way to authenticate to the official servers is providing your [Authorization Token](https://docs.screeps.com/auth-tokens.html) into the `token` parameter.
1816

1917
```python
2018
import screepsapi
21-
USER = "MyUsername"
22-
PASSWORD = "TimeTravelingSecretAgentForHire"
23-
api = screepsapi.API(USER, PASSWORD)
19+
TOKEN = "3bdd1da7-3002-4aaa-be91-330562f54093"
20+
api = screepsapi.API(token=TOKEN)
2421
```
2522

23+
An optional `prefix` parameter can be included with values such as `"/ptr"` for the Public Test Realm or `"/season"` for Seasonal Server.
2624

2725
It is also possible to access private servers with the `host` and `secure` parameters.
2826

2927
```python
3028
import screepsapi
3129
USER = "MyUsername"
3230
PASSWORD = "TimeTravelingSecretAgentForHire"
33-
api = screepsapi.API(USER, PASSWORD, host="server1.screepspl.us:443", secure=True)
31+
HOST = "server1.screepspl.us:443"
32+
api = screepsapi.API(USER, PASSWORD, host=HOST, secure=True)
3433
```
3534

3635
Note that by default private servers do not use SSL and all traffic is unencrypted.
3736

3837
### API
3938

40-
The API itself is a simple REST-based API. Each method in the api library corresponds to a different endpoint for the API.
39+
The API class is a simple REST-based API. Each method corresponds to a different Screeps API endpoint.
4140

42-
The best way to discover functionality is to read through the library itself.
41+
The best way to discover functionality is to read through the [screepsapi library](screepsapi/screepsapi.py) or [Endpoints.md](docs/Endpoints.md)
4342

4443
#### Console Example
4544

4645
```python
4746
import screepsapi
48-
USER = "MyUsername"
49-
PASSWORD = "TimeTravelingSecretAgentForHire"
50-
api = screepsapi.API(USER, PASSWORD, host="server1.screepspl.us:443", secure=True)
47+
TOKEN = "3bdd1da7-3002-4aaa-be91-330562f54093"
48+
api = screepsapi.API(token=TOKEN)
5149

5250
# Run "Game.time" on shard1 via the console
53-
api.console('Game.time', shard='shard1')
51+
api.console("Game.time", shard="shard1")
5452
```
5553

5654
#### User Information Example
5755

5856
```python
5957
import screepsapi
60-
USER = "MyUsername"
61-
PASSWORD = "TimeTravelingSecretAgentForHire"
62-
api = screepsapi.API(USER, PASSWORD, host="server1.screepspl.us:443", secure=True)
58+
TOKEN = "3bdd1da7-3002-4aaa-be91-330562f54093"
59+
api = screepsapi.API(token=TOKEN)
6360

64-
# Find the GCL for `tedivm`
61+
# Find the GCL for "tedivm"
6562
user = api.user_find("tedivm")
6663
print user["user"]["gcl"]
6764
```
@@ -71,3 +68,7 @@ print user["user"]["gcl"]
7168
Screeps provides a sizable amount of data over a websocket. This includes console data and room details.
7269

7370
The best way to utilize the socket is to extend `screepsapi.Socket` and override the various abstract functions.
71+
72+
## Credentials
73+
74+
App developers are encouraged to align with [SS3: Unified Credentials File v1.0](https://github.com/screepers/screepers-standards/blob/master/SS3-Unified_Credentials_File.md) to standardize Screeps credentials storage with other third party tools.

0 commit comments

Comments
 (0)