Skip to main content

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

Metadata

Release files for icecola 0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for icecola 0.6
File Size Uploaded
icecola-0.6.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for icecola 0.6
File Interpreter ABI Platform
icecola-0.6-py3-none-any.whl Python 3 none any Details

Total release size: 17.0 kB

Release files / icecola-0.6.tar.gz

Download URL icecola-0.6.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2aee9a7069cd496d8781186c10da6f8128e61a65b4ec49169b0e0f04a3d367ea
BLAKE2b-256 checksum
How to use checksums
4a59c0adb4a1ea9083c96de730b7676e99dbfdc36222ab32de8364466b761fb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.2

Release files / icecola-0.6-py3-none-any.whl

Download URL icecola-0.6-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f9c63fc02de272a44a73b76cf90e30fc2463b5533ad65bad8fe520d67987bc3
BLAKE2b-256 checksum
How to use checksums
9fcd72aa80a40161857d515528388f7400d1c37a859a0a19a3f44cb5d83f3cd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.6 This release

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page