Skip to main content

A minimal diary manager based on python.

Project description

diapy

Version 3.1.1

A minimal diary manager based on python.

Diapy uses cryptography.fernet to encrypt your top secret.

Installation

Simple, crude.

pip install diapy

Usage

Firstly, you need to create a new diary file. Or you can open an exist file. There isn't much difference.

>>> from diapy import Diary
>>> d = Diary('new.diary')
Please input the main password: # Enter your password here! No one will see it.
>>>

You can keep your today's diary without inputing dates.

>>> d.new('Today is a good day!')
2018-08-12 18:37:02 Sunday
Today is a good day!
>>>

If you have written a diary on the same day, you will be asked to choose.

>>> d.new('I forget writing diary or not.')
You have written a diary today:
2018-08-12 18:37:02 Sunday
Today is a good day!

Do you want to overwrite, discard changes or merge them together?
(overwrite/discard/merge) Default: discard
merge # If you input merge, diapy will keep your diary after the previous one. The time will use the current one.
2018-08-12 19:18:07 Sunday
Today is a good day!
I forget writing diary or not.

If you forget to write a diary yesterday, you can give a datetime object to the function.

>>> from datetime import datetime
>>> yesterday = datetime(2018, 8, 11, 19, 34)
>>> d.new('OOPS, I forgot to write my diary yesterday!', yesterday)
2018-08-11 19:34:00 Saturday
OOPS, I forgot to write my diary yesterday!
>>>

You can access your diary by a 8 digit key.

>>> d[20180812]
2018-08-12 18:37:02 Sunday
Today is a good day!
>>>

Actually, it returns an Entry object.

>>> e = d[20180812]
>>> e.timestamp
1534072687
>>> e.content
'Today is a good day!\nI forget writing diary or not.'
>>>

If you wonders how many diaries you have written, you can use the key function.

>>> d.key()
[20180812, 20180811]
>>>

You can change your password. (Not working if you forget your password. 2333)

>>> d.change_pwd()
Please input the new password: 
>>>

To get a random diary entry.

>>> d.random()
2018-08-12 19:18:07 Sunday
Today is a good day!
I forget writing diary or not.
>>>

Search text in your diaries.

>>> d.search('day')
2018-08-12 19:18:07 Sunday
Today is a good day!
I forget writing diary or not.

2018-08-11 19:34:00 Saturday
OOPS, I forgot to write my diary yesterday!

>>>

Exporting and importing diaries. It is often used when you wanted to do something directly to your diary. It is not recommended in most cases.

Notice! It will expose your secrets! Import operation will overwrite your current diary!

>>> d._content
{1534072687: 'Today is a good day!\nI forget writing diary or not.', 1533987240: 'OOPS, I forgot to write my diary yesterday!'}
>>> d._content = {1534072687: 'Today is a bad day!\nI forget writing diary or not.', \
...     1533987240: 'OOPS, I forgot to write my diary yesterday!'}
>>>

When all done, save changes by the close function.

Don't exit without the close function! Or your changes will not be saved.

>>> d.close()
>>>

About

I am a secondary school student in China, and I know my English is not very good. So if someone wants to improve this I will thank a lot!

Contributing

I know, my code is bad too... You can improve it any time you want. I will wait for your pull requests!

Donating

...OK. That's unbeleavable that you will donate to my rough code...

I don't even have an account for donating 233. If you want to encourage me, you can choose to give me some advice.~

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

diapy-3.1.1.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file diapy-3.1.1.tar.gz.

File metadata

  • Download URL: diapy-3.1.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for diapy-3.1.1.tar.gz
Algorithm Hash digest
SHA256 939b791bfb0abd05ee5f0d555cadb78c18de3000feba4a478ee4824ebfb1febd
MD5 5a4f269cb140c73b68fadf43b66217be
BLAKE2b-256 bf4715aabd783448cec1b8e1f182dfe5f855a862f13945cf0a2083a59414455e

See more details on using hashes here.

Supported by

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