Giter Club home page Giter Club logo

Comments (6)

keyz182 avatar keyz182 commented on May 23, 2024

As suggested in my pull request, I believe the best way is to use the python builtin tempfile, as it has no extra dependencies, and is well tested, and cross platform.

import tempfile
cache_dir=tempfile.gettempdir()

Do you see this replacing the home directory fallback, or as a second layer of fallback?

from urlextract.

lipoja avatar lipoja commented on May 23, 2024

For my use case its OK to have it as second option - replacing home. Maybe its better place than user's home. Its not that persistent (as you mentioned) but it is fine by me.

from urlextract.

jayvdb avatar jayvdb commented on May 23, 2024

Why not keep the files in a cache directory according to https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

There are a few packages which provide cross platform-ish xdg support

https://pypi.org/search/?q=xdg

The most commonly used is https://pypi.org/project/appdirs/

from urlextract.

lipoja avatar lipoja commented on May 23, 2024

Thank you for pointing it out.
I used appdirs for getting the user's cache dir.

from urlextract.

roniemartinez avatar roniemartinez commented on May 23, 2024

@lipoja

Trying to reopen an old ticket since there is a permission error on this implementation.

This line throws permission error when there is not enough privilege (tested in Linux):
https://github.com/lipoja/URLExtract/blob/master/urlextract/cachefile.py#L113

Write permission should be checked first before creating the cache directory.

Thanks!

from urlextract.

lipoja avatar lipoja commented on May 23, 2024

This reopened issue should be fixed in v0.14.0.

from urlextract.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.