Skip to content

Feature Request: astropy.utils.data downloader using requests in urllib2 #1123

Closed

Description

@keflavich

For a variety of reasons, but most pressing being a need for cookies 🍪 🍪 🍪, we decided to push towards using requests in place of urllib+urllib2 in astroquery. Unfortunately, this means a different approach than currently implemented in astropy.utils.data.

A progressbar should be possible (e.g. https://gist.github.com/gschizas/3731992) but the caching system may be somewhat more complex.

Activity

  1. eteq commented on May 29, 2013

    @eteq
    Member

    I looked at this a bit, and I don't think it should be too hard... Easier in some ways, because a fair amount of astropy.utils.data is working around odd urllib/urllib2 quirks. The catch is the problem discussed in kennethreitz/requests#1364 (which is actually a urllib3 issue). Once that's addressed, I would be game for adding requests to extern and starting this transition.

    In the meantime, @keflavich, you may want to try to structure the astroquery imports so that you can easily use astropy.extern.requests whenever it actually starts to exist.

  2. eteq commented on May 29, 2013

    @eteq
    Member

    See also #1035 (which I only now noticed).

  3. keflavich commented on May 29, 2013

    @keflavich
    ContributorAuthor

    Thanks @eteq, I also hadn't noticed #1035.

    When you say "structure the imports...", is there anything I need to be careful about? Would it be anything more than a global replace all of import requests with from astropy.extern import requests?

  4. eteq commented on May 30, 2013

    @eteq
    Member

    Yeah, that's probably all that would be necessary, now that you mention it. I was thinking you could do some sort of trick of doing like from astroquery.extern import requests (e.g. add an extern that just imports requests or something), but a global find-and-replace is probably easier. (Although you also have to do from requests import ..., but that should also be easy.)

  5. keflavich commented on Aug 23, 2013

    @keflavich
    ContributorAuthor

    I don't think any changes to astropy are needed at this point, so I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions