File: tutorial_for_developer.md

package info (click to toggle)
buku 5.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,644 kB
  • sloc: python: 8,052; sql: 164; sh: 104; makefile: 15
file content (41 lines) | stat: -rw-r--r-- 603 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Tutorial for Developer

## get buku database

```ptyhon
>>> import buku
>>> bdb = buku.BukuDb()
```

## simplest way to add url to buku

```python
>>> rec_id = bdb.add_rec('http://example.com')
>>> rec_id
40296
```

## get record id from url

```python
>>> url = 'https://example.com'
>>> rec_id = bdb.add_rec(url)
... if rec_id == -1:
...     rec_id = bdb.get_rec_id(url)
>>> rec_id
40296
```

## get url data from record id

```python
>>> rec = bdb.get_rec_by_id(40296)
>>> rec
(40296, 'http://example.com', 'Example Domain', ',', '', 0)
```

## get tag list

```python
rec[3].split(buku.delim)
```