Skip to content

Commit

Permalink
feat(app): update user agent header
Browse files Browse the repository at this point in the history
  • Loading branch information
skyme5 committed Nov 14, 2024
1 parent e97c579 commit 9b382d0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion snapchat_dl/snapchat_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ def __init__(

def _api_response(self, username):
web_url = self.endpoint_web.format(username)
return requests.get(web_url).text
return requests.get(
web_url,
headers={
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
},
).text

def _web_fetch_story(self, username):
"""Download user stories from Web.
Expand Down
2 changes: 1 addition & 1 deletion snapchat_dl/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.0.0"
__version__ = "2.0.1"
4 changes: 2 additions & 2 deletions tests/test_snapchat_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def test_class_init(self):

def test_invalid_username(self):
"""Test snapchat_dl Stories are not available."""
with self.assertRaises(NoStoriesFound):
self.snapchat_dl.download("username")
with self.assertRaises(UserNotFoundError):
self.snapchat_dl.download("use=rname")

@mock.patch("snapchat_dl.snapchat_dl.SnapchatDL._api_response")
def test_api_error(self, api_response):
Expand Down

0 comments on commit 9b382d0

Please sign in to comment.