Skip to main content

A util package for python

Project description

utils for Flask Web & Crawler

image

philosophy: DRY don't repeat yourself

install

pip3 install icecola

flask_utils

  • ModelViewSet: quickly build CRUD for REST api, like django_restframework

views.py

from flask_utils.restframework import ModelViewSet

from jasmine_app.models.user import User
from jasmine_app.models.video import Video


class UserView(ModelViewSet):
    model_class = User


class Video(ModelViewSet):
    model_class = Video

urls.py

from jasmine_app.api.views import UserView, Video
from flask_utils.views import register_api

from . import api

register_api(api, Video, "video_api", "/video/")
register_api(api, UserView, "user_api", "/user/")

crawler utils

add cache implement for crawler

def test_mongo_cache(mongo_cache):
    key1 = "key"
    value1 = "value"

    mongo_cache[key1] = value1
    assert mongo_cache[key1] == value1
    assert len(mongo_cache) == 1
    assert set(mongo_cache.keys()) == {key1}
    assert set(mongo_cache.values()) == {value1}
    mongo_cache.destroy()
    assert len(mongo_cache) == 0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

icecola-0.5.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

icecola-0.5-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file icecola-0.5.tar.gz.

File metadata

  • Download URL: icecola-0.5.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for icecola-0.5.tar.gz
Algorithm Hash digest
SHA256 6a0e9f9b1c25052fb4efc92c12959cb9ff83e7f05d5c21114876a24c2fc641da
MD5 f683e31f314cf141ccf330d7c6966036
BLAKE2b-256 0a5c968d9830690dac2968d9654f9d518f1709c1b79b60a9eaf2d26784fe4a72

See more details on using hashes here.

File details

Details for the file icecola-0.5-py3-none-any.whl.

File metadata

  • Download URL: icecola-0.5-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for icecola-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5336ba43fea34889b467c440d940f80c3f117387262e5878a3c1f9ad0c0bb944
MD5 a95bbc2b18b48ffca2df1811cd408668
BLAKE2b-256 3762d8e4bdcab1487a4323297d3b240e6dcf3c5a9ec365c8c1317712469f9c18

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page