Skip to content

Commit

Permalink
docs update
Browse files Browse the repository at this point in the history
503 changed to int as per docs
  • Loading branch information
liampauling committed Jul 27, 2020
1 parent 9871a82 commit 6666e79
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions docs/streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ When used in production it is recommended not to start the stream in a new threa

Please see the example [examplestreamingerrhandling.py](https://github.com/liampauling/betfair/blob/master/examples/examplestreamingerrhandling.py)

Sometimes betfair will suspend the stream via the use of a status=503 update, more info [here](https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Exchange+Stream+API#ExchangeStreamAPI-StreamAPIStatus-latency), when the stream is receiving this update the `listener.status` will be updated:

```python
>>> listener.status
503
```

### Listener

You can create a custom listener by overriding the listener class:
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/streaming_503.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"op":"mcm","id":2,"status":"503"}
{"op":"mcm","id":2,"status":503}
2 changes: 1 addition & 1 deletion tests/unit/test_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def test_on_data_status_error(
mock_error_handler.assert_called_with(
mock_response.json(), mock_response.json().get("id")
)
self.assertEqual(self.stream_listener.status, "503")
self.assertEqual(self.stream_listener.status, 503)

def test_on_connection(self):
self.stream_listener._on_connection({"connectionId": 1234}, 1)
Expand Down

0 comments on commit 6666e79

Please sign in to comment.