Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support load/save cookie_jar #1219

Closed
ahuigo opened this issue Sep 27, 2016 · 4 comments
Closed

Support load/save cookie_jar #1219

ahuigo opened this issue Sep 27, 2016 · 4 comments

Comments

@ahuigo
Copy link
Contributor

ahuigo commented Sep 27, 2016

I found that cookie_jar do not provide any function to load or save cookie_jar

Is there any pythonic way to implement these two method?

session.cookie_jar.load('foo.cookie.txt')
....# do sth.
session.cookie_jar.save()

@asvetlov
Copy link
Member

Thank you for raising the question!

It's definitely possible but not implemented yet.

The problem is the cookies storage format.
I believe making it compatible with everything doesn't make sense.
If we'll make an agreement that the storage is just opaque binary data (a pickled dict of SimpleCookies actually) -- implementation is reduced to pickling/unpickling CookieJar._cookies attribute.

Another option is adding pickle support to CookieJar itself without adding load()/save() methods.

@AHui132 would you work on Pull Request?

@ahuigo
Copy link
Contributor Author

ahuigo commented Oct 14, 2016

I've commited support load/save cookie_jar. And it works well.

But encountered a problem about py.test(I have never written a py.test case before),
It seemed that I should install fixture event_loop and mocker, I do not know how to do it.

___________________________________ ERROR at setup of test_index ___________________________________
file /usr/local/lib/python3.5/site-packages/aiohttp.src/demos/polls/tests/test_integration.py, line 13
  def test_index(create_app, event_loop, app_db):
file /usr/local/lib/python3.5/site-packages/aiohttp.src/demos/polls/tests/conftest.py, line 9
  @pytest.yield_fixture
  def create_app(event_loop, unused_tcp_port):
E       fixture 'event_loop' not found
>       available fixtures: LineMatcher, _pytest, anypython, app_db, cache, capfd, capsys, create_app, doctest_namespace, linecomp, loop, monkeypatch, pytestconfig, record_xml_property, recwarn, test_client, test_server, testdir, tmpdir, tmpdir_factory, unused_port
>       use 'pytest --fixtures [testpath]' for help on them.

____________________________ ERROR at setup of test_access_logger_atoms ____________________________
file /usr/local/lib/python3.5/site-packages/aiohttp.src/tests/test_helpers.py, line 148
  def test_access_logger_atoms(mocker):
E       fixture 'mocker' not found
>       available fixtures: LineMatcher, _pytest, anypython, cache, capfd, capsys, doctest_namespace, linecomp, log, loop, monkeypatch, pytestconfig, record_xml_property, recwarn, test_client, test_server, testdir, tmpdir, tmpdir_factory, unused_port
>       use 'pytest --fixtures [testpath]' for help on them.

I won't add pull request until this problem is solved.

@asvetlov
Copy link
Member

Did you try pip install -r requirements-dev.txt ?

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants