Skip to content

Commit

Permalink
Merge 5999ccd into abb3d43
Browse files Browse the repository at this point in the history
  • Loading branch information
LilSpazJoekp committed Jan 26, 2021
2 parents abb3d43 + 5999ccd commit 9f4a86e
Show file tree
Hide file tree
Showing 21 changed files with 682 additions and 1,014 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Expand Up @@ -40,6 +40,7 @@ Unreleased
* Some cases where streams yield the same item multiple times. This cannot be
prevented in every case.
* An issue where streams could get stuck on a deleted item and never pull new items.
* Fix subreddit style asset uploading.

7.1.0 (2020/07/16)
------------------
Expand Down
3 changes: 2 additions & 1 deletion asyncpraw/models/reddit/subreddit.py
Expand Up @@ -3484,8 +3484,9 @@ async def _upload_style_asset(self, image_path, image_type):
upload_url = f"https:{upload_lease['action']}"

with open(image_path, "rb") as image:
upload_data["file"] = image
response = await self.subreddit._reddit._core._requestor._http.post(
upload_url, data=upload_data, files={"file": image}
upload_url, data=upload_data
)
response.raise_for_status()

Expand Down
10 changes: 0 additions & 10 deletions asyncpraw/reddit.py
Expand Up @@ -837,16 +837,6 @@ async def request(
(default: None). If ``json`` is provided, ``data`` should not be.
"""
# this a fix for aiohttp not liking bool values in its params; this should be
# fixed asyncprawcore
if params:
new_params = {}
for k, v in params.items():
if isinstance(v, bool):
new_params[k] = str(v).lower()
elif v:
new_params[k] = v
params = new_params
if data and json:
raise ClientException("At most one of `data` and `json` is supported.")
try:
Expand Down
152 changes: 62 additions & 90 deletions tests/integration/cassettes/TestReddit.test_random_subreddit.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

218 changes: 91 additions & 127 deletions tests/integration/cassettes/TestSubreddit.test_random.json

Large diffs are not rendered by default.

Expand Up @@ -23,7 +23,7 @@
"close"
],
"User-Agent": [
"<USER_AGENT> Async PRAW/7.1.1.dev0 asyncprawcore/1.4.0.post1"
"<USER_AGENT> Async PRAW/7.1.1.dev0 asyncprawcore/1.5.1"
]
},
"method": "POST",
Expand All @@ -35,20 +35,16 @@
},
"headers": {
"Accept-Ranges": "bytes",
"Cache-Control": "max-age=0, must-revalidate",
"Connection": "close",
"Content-Length": "367",
"Content-Length": "370",
"Content-Type": "application/json; charset=UTF-8",
"Date": "Mon, 13 Jul 2020 01:46:39 GMT",
"Date": "Mon, 25 Jan 2021 23:58:10 GMT",
"Server": "snooserv",
"Set-Cookie": "edgebucket=4vtJLj8GIsimNQm8Ol; Domain=reddit.com; Max-Age=63071999; Path=/; secure",
"Set-Cookie": "edgebucket=PfQFWQsOhV5xyzqy3h; Domain=reddit.com; Max-Age=63071999; Path=/; secure",
"Strict-Transport-Security": "max-age=15552000; includeSubDomains; preload",
"Via": "1.1 varnish",
"X-Cache": "MISS",
"X-Cache-Hits": "0",
"X-Moose": "majestic",
"X-Served-By": "cache-mci5932-MCI",
"X-Timer": "S1594604799.374607,VS0,VE118",
"cache-control": "max-age=0, must-revalidate",
"x-content-type-options": "nosniff",
"x-frame-options": "SAMEORIGIN",
"x-xss-protection": "1; mode=block"
Expand All @@ -71,50 +67,46 @@
"bearer <ACCESS_TOKEN>"
],
"User-Agent": [
"<USER_AGENT> Async PRAW/7.1.1.dev0 asyncprawcore/1.4.0.post1"
"<USER_AGENT> Async PRAW/7.1.1.dev0 asyncprawcore/1.5.1"
]
},
"method": "GET",
"uri": "https://oauth.reddit.com/r/wallpapers/random/?raw_json=1"
"uri": "https://oauth.reddit.com/r/wallpapers/random/?unique=0&raw_json=1"
},
"response": {
"body": {
"string": ""
},
"headers": {
"Accept-Ranges": "bytes",
"Cache-Control": "private, s-maxage=0, max-age=0, must-revalidate, no-store, max-age=0, must-revalidate",
"Connection": "keep-alive",
"Content-Length": "0",
"Content-Type": "application/json; charset=UTF-8",
"Date": "Mon, 13 Jul 2020 01:46:40 GMT",
"Expires": "-1",
"Location": "https://www.reddit.com/r/wallpapers/.json?utm_campaign=redirect&utm_medium=desktop&utm_source=reddit&utm_name=random_link",
"Date": "Mon, 25 Jan 2021 23:58:11 GMT",
"Server": "snooserv",
"Set-Cookie": "csv=1; Max-Age=63072000; Domain=.reddit.com; Path=/; Secure; SameSite=None",
"Strict-Transport-Security": "max-age=15552000; includeSubDomains; preload",
"Via": "1.1 varnish",
"X-Cache": "MISS",
"X-Cache-Hits": "0",
"X-Moose": "majestic",
"X-Served-By": "cache-mci5929-MCI",
"X-Timer": "S1594604800.566370,VS0,VE630",
"cache-control": "private, s-maxage=0, max-age=0, must-revalidate, no-store, max-age=0, must-revalidate",
"expires": "-1",
"location": "https://www.reddit.com/r/wallpapers/.json?utm_campaign=redirect&utm_medium=desktop&utm_source=reddit&utm_name=random_link",
"x-content-type-options": "nosniff",
"x-frame-options": "SAMEORIGIN",
"x-ratelimit-remaining": "230.0",
"x-ratelimit-reset": "201",
"x-ratelimit-used": "370",
"x-ratelimit-remaining": "139.0",
"x-ratelimit-reset": "110",
"x-ratelimit-used": "461",
"x-ua-compatible": "IE=edge",
"x-xss-protection": "1; mode=block"
},
"status": {
"code": 302,
"message": "Found"
},
"url": "https://oauth.reddit.com/r/wallpapers/random/?raw_json=1"
"url": "https://oauth.reddit.com/r/wallpapers/random/?unique=0&raw_json=1"
}
}
],
"recorded_at": "2020-07-12T20:46:40",
"recorded_at": "2021-01-25T17:58:11",
"version": 1
}

0 comments on commit 9f4a86e

Please sign in to comment.