semvec/pypi-packages huggingface dataset:
joey 0.4.0
Async web framework on top of fastapi and orm
Requires Python: >=3.8, <4
Keywords: joey web framework orm fastapi

# joey

[![](https://img.shields.io/pypi/v/joey.svg)](https://pypi.org/project/joey/)
[![](https://img.shields.io/pypi/l/joey.svg)](https://github.com/pinecrew/joey/blob/master/LICENSE)

Async web framework on top of [fastapi](https://pypi.org/project/fastapi/) and [orm](https://pypi.org/project/orm/)

# How to start
Let's create demo project
```sh
$ mkdir demo-project
$ cd demo-project
$ pipenv install joey
$ pipenv shell
$ joey init 
```

Joey will create the following project structure
```sh
.
├── alembic.ini
├── asgi.py
├── migrations
│   ├── env.py
│   ├── script.py.mako
│   └── versions
└── settings
    ├── common.py
    ├── common.yml
    ├── development.py
    └── __init__.py
```

Let's add the application to the given project structure
```sh
$ joey add hello
# or with autoregister parameter
$ joey add -a hello
```

Joey will add the following files in a separate folder
```sh
.
└── hello
    ├── __init__.py
    ├── models.py
    └── routes.py
```

If you use `-a` flag then **joey** automatic register your app and route in project settings file
```yaml
APPLICATIONS:
- hello
ROUTES:
  hello:
    prefix: /hello
    tags:
    - hello
```
otherwise manually edit `settings/common.yml` file.

Now implement model in file  `hello/models.py`
```py
class Item(Model):
    id = orm.Integer(primary_key=True)
    text = orm.Text()
```

Implement a simple route in `hello/routes.py`, than can access to database
```py
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel


from hello.models import Item as ItemDB


class Item(BaseModel):
    text: str


router = APIRouter()

@router.post('/{id}', response_model=Item)
async def item(id: int) -> Item:
    try:
        return await ItemDB.objects.get(id=id)
    except ItemDB.DoesNotExist:
        raise HTTPException(status_code=404, detail='Item not found')
```


Next step - create a database, then migrate it and add a couple of elements
```sh
$ joey revise 'init database'
$ joey migrate
$ sqlite3 db.sqlite "insert into items (text) values ('hello'), ('joe here');"
```

Everything is ready, now you can start with uvicorn
```sh
$ joey run
# or
$ uvicorn asgi:app --reload
```

And request data with Swagger UI by `http://localhost:8000/docs`.
SimpleEmailBot 0.0.1
Simple package to email you when scripts are finished.
Keywords: email,simple

# SimpleEmailBot
SimpleEmailBot is a very simple Python package to 
send an email when a script is completed. I use 
this mainly to let me know when deep 
learning models have finished training. 

## Install
SimpleEmailBot is on pip, just run
```
pip install simpleemailbot
```
## Usage

### Bot email
First you need an email for the bot, currently this 
only works with gmail so make a new gmail account [here](https://accounts.google.com/signup).
You also need to go to settings and set allow less secure apps to ON. [Link](https://myaccount.google.com/lesssecureapps). Be careful because this makes the account less secure, that's why we want to 
make a new account. Make sure you are doing this with the new account and not your own gmail also. 

### Secrets
Now you need to put the username and password in a file somewhere
so that they don't end up in your code. This is done with a file at `~/.emailbot`
which is tab separated and contains an identifier, the email address and the password.
e.g.


```bot    mybot@gmail.com password123```

**Make sure you use tabs and not spaces**.
Also you should run `chmod 600 ~/.emailbot`. This 
makes sure only you have read and write permissions.
You can change where the secrets are 
kept with `EmailBot.set_secrets_path()`
### Code
No more setup to do now, here is an example usage.

```python
from simpleemailbot import EmailBot
# bot is the identifier in the secrets file
# don't put anything that identifies the email or password in your code
bot = EmailBot("myemail@gmail.com", "bot")

bot.email_me()
```
This sends an email to myemail@gmail 
with the subject "Task Complete" and the content "Task Complete".

If you want you can change the subject and message:
```python
bot.email_me(subject="Error", message="Oh no something went wrong!")
```
bd-time 0.0.1
bode's private time model.
Requires Python: >=3.6

# bode's time model.
> bd_time

```
from bd_time import Time()
tt = Time()
tt.now(1)  # 输出当前运行的时间
tt.during(10)  # 检测运行时间是否在10秒内
tt.get_key_state('a')  # 检测'a'键是否按下
tt.stop_alt('a')      # 如果按下[Alt + a]键就推出
```