Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @JimmyPettersson85 @xernobyl @yaziine
* @JimmyPettersson85 @xernobyl
8 changes: 2 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ jobs:
strategy:
max-parallel: 1
matrix:
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # gives the commit linter access to previous commits

- name: Commit message linter
if: ${{ matrix.python == '3.7' }}
uses: wagoid/commitlint-github-action@v4

- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}
Expand All @@ -34,7 +30,7 @@ jobs:
run: pip install -q ".[test, ci]"

- name: Lint with ${{ matrix.python }}
if: ${{ matrix.python == '3.7' }}
if: ${{ matrix.python == '3.8' }}
run: make lint

- name: Install, test and code coverage with ${{ matrix.python }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [5.4.0](https://github.com/GetStream/stream-python/compare/v5.3.1...v5.4.0) (2025-09-30)

### [5.3.1](https://github.com/GetStream/stream-python/compare/v5.2.1...v5.3.1) (2023-10-25)

### [5.2.1](https://github.com/GetStream/stream-python/compare/v5.2.0...v5.2.1) (2023-02-27)

## [5.2.0](https://github.com/GetStream/stream-python/compare/v5.1.1...v5.2.0) (2023-02-16)
Expand Down
16 changes: 16 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Reporting a Vulnerability
At Stream we are committed to the security of our Software. We appreciate your efforts in disclosing vulnerabilities responsibly and we will make every effort to acknowledge your contributions.

Report security vulnerabilities at the following email address:
```
[security@getstream.io](mailto:security@getstream.io)
```
Alternatively it is also possible to open a new issue in the affected repository, tagging it with the `security` tag.

A team member will acknowledge the vulnerability and will follow-up with more detailed information. A representative of the security team will be in touch if more information is needed.

# Information to include in a report
While we appreciate any information that you are willing to provide, please make sure to include the following:
* Which repository is affected
* Which branch, if relevant
* Be as descriptive as possible, the team will replicate the vulnerability before working on a fix.
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from stream import __version__, __maintainer__, __email__, __license__

install_requires = [
"requests>=2.28.0,<3",
"pyjwt>=2.6.0,<3",
"pytz>=2022.7.1",
"aiohttp>=3.8.4",
"requests>=2.31.0,<3",
"pyjwt>=2.8.0,<3",
"pytz>=2023.3.post1",
"aiohttp>=3.9.0b0",
]
tests_require = ["pytest", "pytest-cov", "python-dateutil", "pytest-asyncio"]
ci_require = ["black", "flake8", "pytest-cov"]
Expand Down
5 changes: 4 additions & 1 deletion stream/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
__copyright__ = "Copyright 2022, Stream.io, Inc"
__credits__ = ["Thierry Schellenbach, mellowmorning.com, @tschellenbach"]
__license__ = "BSD-3-Clause"
__version__ = "5.2.1"
__version__ = "5.4.0"
__maintainer__ = "Thierry Schellenbach"
__email__ = "support@getstream.io"
__status__ = "Production"
Expand All @@ -31,6 +31,9 @@ def connect(
"""
from stream.client import AsyncStreamClient, StreamClient

if location is None:
location = os.environ.get("STREAM_REGION")

stream_url = os.environ.get("STREAM_URL")
# support for the heroku STREAM_URL syntax
if stream_url and not api_key:
Expand Down
8 changes: 0 additions & 8 deletions stream/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def __unicode__(self):


class ApiKeyException(StreamApiException):

"""
Raised when there is an issue with your Access Key
"""
Expand All @@ -25,7 +24,6 @@ class ApiKeyException(StreamApiException):


class SignatureException(StreamApiException):

"""
Raised when there is an issue with the signature you provided
"""
Expand All @@ -35,7 +33,6 @@ class SignatureException(StreamApiException):


class InputException(StreamApiException):

"""
Raised when you send the wrong data to the API
"""
Expand All @@ -45,7 +42,6 @@ class InputException(StreamApiException):


class CustomFieldException(StreamApiException):

"""
Raised when there are missing or misconfigured custom fields
"""
Expand All @@ -55,7 +51,6 @@ class CustomFieldException(StreamApiException):


class FeedConfigException(StreamApiException):

"""
Raised when there are missing or misconfigured custom fields
"""
Expand All @@ -65,7 +60,6 @@ class FeedConfigException(StreamApiException):


class SiteSuspendedException(StreamApiException):

"""
Raised when the site requesting the data is suspended
"""
Expand All @@ -75,7 +69,6 @@ class SiteSuspendedException(StreamApiException):


class InvalidPaginationException(StreamApiException):

"""
Raised when there is an issue with your Access Key
"""
Expand Down Expand Up @@ -108,7 +101,6 @@ class RankingException(FeedConfigException):


class RateLimitReached(StreamApiException):

"""
Raised when too many requests are performed
"""
Expand Down
8 changes: 7 additions & 1 deletion stream/reactions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def add(
data=None,
target_feeds=None,
target_feeds_extra_data=None,
moderation_template=None,
):
pass

Expand All @@ -23,7 +24,11 @@ def update(self, reaction_id, data=None, target_feeds=None):
pass

@abstractmethod
def delete(self, reaction_id):
def delete(self, reaction_id, soft=False):
pass

@abstractmethod
def restore(self, reaction_id):
pass

@abstractmethod
Expand All @@ -35,6 +40,7 @@ def add_child(
data=None,
target_feeds=None,
target_feeds_extra_data=None,
moderation_template=None,
):
pass

Expand Down
34 changes: 32 additions & 2 deletions stream/reactions/reaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def add(
data=None,
target_feeds=None,
target_feeds_extra_data=None,
moderation_template=None,
):
payload = dict(
kind=kind,
Expand All @@ -19,6 +20,8 @@ def add(
target_feeds_extra_data=target_feeds_extra_data,
user_id=user_id,
)
if moderation_template is not None:
payload["moderation_template"] = moderation_template
return self.client.post(
self.API_ENDPOINT,
service_name=self.SERVICE_NAME,
Expand All @@ -42,9 +45,18 @@ def update(self, reaction_id, data=None, target_feeds=None):
data=payload,
)

def delete(self, reaction_id):
def delete(self, reaction_id, soft=False):
url = f"{self.API_ENDPOINT}{reaction_id}"
return self.client.delete(
url,
service_name=self.SERVICE_NAME,
signature=self.token,
params={"soft": soft},
)

def restore(self, reaction_id):
url = f"{self.API_ENDPOINT}{reaction_id}/restore"
return self.client.put(
url, service_name=self.SERVICE_NAME, signature=self.token
)

Expand All @@ -56,6 +68,7 @@ def add_child(
data=None,
target_feeds=None,
target_feeds_extra_data=None,
moderation_template=None,
):
payload = dict(
kind=kind,
Expand All @@ -65,6 +78,8 @@ def add_child(
target_feeds_extra_data=target_feeds_extra_data,
user_id=user_id,
)
if moderation_template is not None:
payload["moderation_template"] = moderation_template
return self.client.post(
self.API_ENDPOINT,
service_name=self.SERVICE_NAME,
Expand All @@ -91,6 +106,7 @@ async def add(
data=None,
target_feeds=None,
target_feeds_extra_data=None,
moderation_template=None,
):
payload = dict(
kind=kind,
Expand All @@ -100,6 +116,8 @@ async def add(
target_feeds_extra_data=target_feeds_extra_data,
user_id=user_id,
)
if moderation_template is not None:
payload["moderation_template"] = moderation_template
return await self.client.post(
self.API_ENDPOINT,
service_name=self.SERVICE_NAME,
Expand All @@ -123,9 +141,18 @@ async def update(self, reaction_id, data=None, target_feeds=None):
data=payload,
)

async def delete(self, reaction_id):
async def delete(self, reaction_id, soft=False):
url = f"{self.API_ENDPOINT}{reaction_id}"
return await self.client.delete(
url,
service_name=self.SERVICE_NAME,
signature=self.token,
params={"soft": soft},
)

async def restore(self, reaction_id):
url = f"{self.API_ENDPOINT}{reaction_id}/restore"
return await self.client.put(
url, service_name=self.SERVICE_NAME, signature=self.token
)

Expand All @@ -137,6 +164,7 @@ async def add_child(
data=None,
target_feeds=None,
target_feeds_extra_data=None,
moderation_template=None,
):
payload = dict(
kind=kind,
Expand All @@ -146,6 +174,8 @@ async def add_child(
target_feeds_extra_data=target_feeds_extra_data,
user_id=user_id,
)
if moderation_template is not None:
payload["moderation_template"] = moderation_template
return await self.client.post(
self.API_ENDPOINT,
service_name=self.SERVICE_NAME,
Expand Down
Loading