tailread


Nametailread JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/zwolf21/tailread
SummaryA Simple line generator from tail of file
upload_time2022-06-09 07:27:30
maintainer
docs_urlNone
authorHS Moon
requires_python>=3.4
licenseMIT
keywords tail python tail tailread
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # readtail

### Simple Description

- A simplest generator function written in pure python
- Seek from the tail of the file

### Install
```shell
pip install tailread
```


### Useage

```python
import tailread as tail

# consuming tails one by one
  lines = tail.readlines('access.log')

  # take tail of one line
  line = next(lines)
  print(line)
# b'line 10/r/n'

  # next...
  line = next(lines)
  print(line)
# b'line 9/r/n'


# When passing a fileobject, The file must be opened in bytes mode.
with open('access.log', 'rb'): as fp:
    for line in tail.readlines(fp):
        print(line)
        if 'some string' in line:
            break
        

# or from file path
for line in tail.readlines('access.log'):
    print(line)
      if 'some string' in line:
          break

# b'line 10\r\n'
# b'line 9\r\n'
# b'line 8\r\n'
# b'line 7\r\n'
# ....

```

```python
# decoding lines from encoding info
for line in tail.readlines('access.log', encoding='utf-8', errors='ignore'):
    print(line)

# line 10

# line 9

# line 8

# line 7

# ....


```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zwolf21/tailread",
    "name": "tailread",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.4",
    "maintainer_email": "",
    "keywords": "tail,python tail,tailread",
    "author": "HS Moon",
    "author_email": "pbr112@naver.com",
    "download_url": "https://files.pythonhosted.org/packages/0a/6b/b79e2b8774594eb6d011a3c9cbdffa4c4233c00c368a010fb1cbd2ea9545/tailread-1.0.2.tar.gz",
    "platform": null,
    "description": "# readtail\r\n\r\n### Simple Description\r\n\r\n- A simplest generator function written in pure python\r\n- Seek from the tail of the file\r\n\r\n### Install\r\n```shell\r\npip install tailread\r\n```\r\n\r\n\r\n### Useage\r\n\r\n```python\r\nimport tailread as tail\r\n\r\n# consuming tails one by one\r\n  lines = tail.readlines('access.log')\r\n\r\n  # take tail of one line\r\n  line = next(lines)\r\n  print(line)\r\n# b'line 10/r/n'\r\n\r\n  # next...\r\n  line = next(lines)\r\n  print(line)\r\n# b'line 9/r/n'\r\n\r\n\r\n# When passing a fileobject, The file must be opened in bytes mode.\r\nwith open('access.log', 'rb'): as fp:\r\n    for line in tail.readlines(fp):\r\n        print(line)\r\n        if 'some string' in line:\r\n            break\r\n        \r\n\r\n# or from file path\r\nfor line in tail.readlines('access.log'):\r\n    print(line)\r\n      if 'some string' in line:\r\n          break\r\n\r\n# b'line 10\\r\\n'\r\n# b'line 9\\r\\n'\r\n# b'line 8\\r\\n'\r\n# b'line 7\\r\\n'\r\n# ....\r\n\r\n```\r\n\r\n```python\r\n# decoding lines from encoding info\r\nfor line in tail.readlines('access.log', encoding='utf-8', errors='ignore'):\r\n    print(line)\r\n\r\n# line 10\r\n\r\n# line 9\r\n\r\n# line 8\r\n\r\n# line 7\r\n\r\n# ....\r\n\r\n\r\n```\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Simple line generator from tail of file",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/zwolf21/tailread"
    },
    "split_keywords": [
        "tail",
        "python tail",
        "tailread"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0a6bb79e2b8774594eb6d011a3c9cbdffa4c4233c00c368a010fb1cbd2ea9545",
                "md5": "8d55884159eff1519e0c65472ce4e3a7",
                "sha256": "5ab113f8defdf88f80b6d3b2ca7c34be2000bd53499504adc2b845e1c0742650"
            },
            "downloads": -1,
            "filename": "tailread-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "8d55884159eff1519e0c65472ce4e3a7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.4",
            "size": 2658,
            "upload_time": "2022-06-09T07:27:30",
            "upload_time_iso_8601": "2022-06-09T07:27:30.142980Z",
            "url": "https://files.pythonhosted.org/packages/0a/6b/b79e2b8774594eb6d011a3c9cbdffa4c4233c00c368a010fb1cbd2ea9545/tailread-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-06-09 07:27:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zwolf21",
    "github_project": "tailread",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "tailread"
}
        
Elapsed time: 0.17909s