Skip to content

Instantly share code, notes, and snippets.

View aprilahijriyan's full-sized avatar
🐼
🐍 Python Developer

Aprila Hijriyan aprilahijriyan

🐼
🐍 Python Developer
  • Indonesia, Garut - Jawa Barat
  • 14:17 (UTC +07:00)
View GitHub Profile
@aprilahijriyan
aprilahijriyan / ajax_requests.py
Last active July 23, 2021 13:01
Simple Asynchronous Python HTTP requests are similar to jQuery.ajax requests
from concurrent.futures import Future
from requests_futures.sessions import FuturesSession
from requests.exceptions import ConnectionError
class AjaxSession(FuturesSession):
"""
Simple HTTP Request yang memudahkan anda berinteraksi dengan server
pada background-process melalui event handler yang tersedia.
Kelas ini di desain seperti ``jQuery.ajax``, yang menyediakan event handler (dengan tambahan sedikit).
@aprilahijriyan
aprilahijriyan / pydantic_from_marshmallow.py
Created September 24, 2020 21:14 — forked from kmatarese/pydantic_from_marshmallow.py
Hack to convert marshmallow schemas to pydantic models
"""WARNING: not thoroughly tested and does not support full translation
between the two libraries.
Uses a pydantic root_validator to init the marshmallow schema. It attempts
to map marshmallow field types to pydantic field types as well, but not all
field types are supported.
You can either use the pydantic_from_marshmallow function that does all of
the above or just subclass MarshmallowModel and manually define your pydantic
fields/types/etc.
@aprilahijriyan
aprilahijriyan / zemfrog-config.py
Last active March 4, 2021 14:31
Zemfrog configuration
from datetime import timedelta
from os import path
class Development(object):
SECRET_KEY = "Your secret key!"
SQLALCHEMY_DATABASE_URI = "sqlite:///" + path.join(
path.dirname(__file__), "db.sqlite"
)
SQLALCHEMY_TRACK_MODIFICATIONS = False
JWT_SECRET_KEY = "JWT secret key!"