Skip to content

Commit

Permalink
Always share attributes with underlying session instance
Browse files Browse the repository at this point in the history
When an existing session instance was passed into create_scraper,
interesting attributes were copied if they were truthy. However, this
excluded copying attributes of mutable data types that were falsey at
the time. For example, if the cookie jar of the original session was
empty, then cloudscraper wouldn't use the same jar as the original
session and cookies would get out of sync between the two.

Now all interesting attributes are synced given they aren't None.
  • Loading branch information
TAAPArthur committed Nov 7, 2021
1 parent f3a3d06 commit e2d9db2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cloudscraper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ def create_scraper(cls, sess=None, **kwargs):
if sess:
for attr in ['auth', 'cert', 'cookies', 'headers', 'hooks', 'params', 'proxies', 'data']:
val = getattr(sess, attr, None)
if val:
if val is not None:
setattr(scraper, attr, val)

return scraper
Expand Down

0 comments on commit e2d9db2

Please sign in to comment.