Skip to content

Commit

Permalink
Merge pull request #2 from 7rs/develop
Browse files Browse the repository at this point in the history
setup.pyとrequirements.txtの追加, README.mdへの記述
  • Loading branch information
7rs authored Jun 6, 2020
2 parents c08a6d8 + ab38d9c commit 2e35e2d
Show file tree
Hide file tree
Showing 24 changed files with 98 additions and 26 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,5 @@ dmypy.json
service/*
thrift_setup.py
test.py
.env
.env
.pypirc
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ python_version = "3.8"
[scripts]
thrift = "python thrift_setup.py"
test = "python test.py"
requirements = "pip freeze > requirements.txt"
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
# line4py
# line4py

## Installtion from [PyPI](https://pypi.org/project/line4py)

`pip install line4py`

## Installtion from [GitHub](https://github.com/7rs/line4py)

`pip install git+ssh://[email protected]/7rs/line4py.git@master`

## Usage

```python
from line4py import Client, ApplicationType

client = Client(ApplicationType.ANDROIDLITE, concurrency=30, secondary=True)
client.login_with_qrcode()
```

## Author

[My Page](https://7rs.github.io)
[Twitter](https://twitter.com/R4XELN)
[Telegram](https://t.me/R4zLn)
4 changes: 2 additions & 2 deletions line4py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from loguru import logger

from .service.TalkService.ttypes import ApplicationType
from .client import Client
from line4py.service.TalkService.ttypes import ApplicationType
from line4py.client import Client

log_format = "<blue>{time:%s}:{process}</blue> <cyan>{name}:{line}</cyan> <level>{level: <8} | {message}</level>" % (
"YYYY-MM-DD-HH:mm:ss.SSS")
Expand Down
4 changes: 2 additions & 2 deletions line4py/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .talk import TalkServiceClient
from .poll import LongPollingClient
from line4py.api.talk import TalkServiceClient
from line4py.api.poll import LongPollingClient
4 changes: 2 additions & 2 deletions line4py/api/poll.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import List, Dict, Callable

from ..service.TalkService import TalkService
from ..service.TalkService.ttypes import Operation, OpType
from line4py.service.TalkService import TalkService
from line4py.service.TalkService.ttypes import Operation, OpType

_MAX_COUNT = 50

Expand Down
4 changes: 2 additions & 2 deletions line4py/api/talk.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Dict, Optional

from ..service.TalkService import TalkService
from ..service.TalkService.ttypes import Message, MessageRelationType, ServiceCode
from line4py.service.TalkService import TalkService
from line4py.service.TalkService.ttypes import Message, MessageRelationType, ServiceCode


class TalkServiceClient(TalkService.Client):
Expand Down
12 changes: 6 additions & 6 deletions line4py/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
from loguru import logger
import axolotl_curve25519 as curve

from .service.TalkService.ttypes import ApplicationType
from .service.TalkService import TalkService
from .service.SecondaryQrCodeLoginService.ttypes import (
from line4py.service.TalkService.ttypes import ApplicationType
from line4py.service.TalkService import TalkService
from line4py.service.SecondaryQrCodeLoginService.ttypes import (
CreateQrSessionRequest, CreateQrCodeRequest, VerifyCertificateRequest,
CreatePinCodeRequest, QrCodeLoginRequest, QrCodeLoginResponse,
SecondaryQrCodeException)
from .service.SecondaryQrCodeLoginPermitNoticeService.ttypes import (
from line4py.service.SecondaryQrCodeLoginPermitNoticeService.ttypes import (
CheckQrCodeVerifiedRequest, CheckPinCodeVerifiedRequest)
from .session import Session
from .token import create_token
from line4py.session import Session
from line4py.token import create_token


def create_message(*args):
Expand Down
2 changes: 1 addition & 1 deletion line4py/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, Dict, Optional

from .service.TalkService.ttypes import ApplicationType
from line4py.service.TalkService.ttypes import ApplicationType

LEGY_HOST = "https://legy-jp-addr.line.naver.jp"
OBS_HOST = "https://obs.line-apps.com"
Expand Down
1 change: 1 addition & 0 deletions line4py/service/AuthService/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__all__ = ['ttypes', 'constants', 'AuthService']
1 change: 1 addition & 0 deletions line4py/service/BuddyService/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__all__ = ['ttypes', 'constants', 'BuddyService']
1 change: 1 addition & 0 deletions line4py/service/CallService/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__all__ = ['ttypes', 'constants', 'CallService']
1 change: 1 addition & 0 deletions line4py/service/ChannelService/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__all__ = ['ttypes', 'constants', 'ChannelService']
1 change: 1 addition & 0 deletions line4py/service/PrimaryAccountInitService/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__all__ = ['ttypes', 'constants', 'PrimaryAccountInitService']
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__all__ = ['ttypes', 'constants', 'SecondaryQrCodeLoginPermitNoticeService']
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__all__ = ['ttypes', 'constants', 'SecondaryQrCodeLoginPermitService']
1 change: 1 addition & 0 deletions line4py/service/SecondaryQrCodeLoginService/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__all__ = ['ttypes', 'constants', 'SecondaryQrCodeLoginService']
1 change: 1 addition & 0 deletions line4py/service/ShopService/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__all__ = ['ttypes', 'constants', 'ShopService']
1 change: 1 addition & 0 deletions line4py/service/TalkService/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__all__ = ['ttypes', 'constants', 'TalkService']
1 change: 1 addition & 0 deletions line4py/service/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

17 changes: 9 additions & 8 deletions line4py/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
from geventhttpclient import HTTPClient
from geventhttpclient.url import URL

from .service.TalkService.ttypes import ApplicationType
from .service.TalkService import TalkService
from .service.SecondaryQrCodeLoginService import SecondaryQrCodeLoginService
from .service.SecondaryQrCodeLoginPermitNoticeService import SecondaryQrCodeLoginPermitNoticeService
from .config import (HeaderBuilder, LEGY_HOST, TALK_SERVICE_V4, LONG_POLLING_V4,
SECONDARY_LOGIN_REQUEST_V1, SECONDARY_LOGIN_CHECK_V1)
from .thrift import THttpClient
from .api import TalkServiceClient, LongPollingClient
from line4py.service.TalkService.ttypes import ApplicationType
from line4py.service.TalkService import TalkService
from line4py.service.SecondaryQrCodeLoginService import SecondaryQrCodeLoginService
from line4py.service.SecondaryQrCodeLoginPermitNoticeService import SecondaryQrCodeLoginPermitNoticeService
from line4py.config import (HeaderBuilder, LEGY_HOST, TALK_SERVICE_V4,
LONG_POLLING_V4, SECONDARY_LOGIN_REQUEST_V1,
SECONDARY_LOGIN_CHECK_V1)
from line4py.thrift import THttpClient
from line4py.api import TalkServiceClient, LongPollingClient

DEFAULT_TIMEOUT = 180.0

Expand Down
2 changes: 1 addition & 1 deletion line4py/thrift.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from geventhttpclient.response import HTTPSocketPoolResponse
from thrift.transport.TTransport import TTransportBase

from .config import LONG_POLLING_V4_PATH
from line4py.config import LONG_POLLING_V4_PATH


class THttpClient(TTransportBase):
Expand Down
16 changes: 16 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
certifi==2020.4.5.1
flake8==3.8.2
gevent==20.5.2
geventhttpclient==1.4.2
greenlet==0.4.16
loguru==0.5.0
mccabe==0.6.1
pycodestyle==2.6.0
pyflakes==2.2.0
python-axolotl-curve25519==0.4.1.post2
python-dotenv==0.13.0
six==1.15.0
thrift==0.13.0
yapf==0.30.0
zope.event==4.4
zope.interface==5.1.0
19 changes: 19 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python

from setuptools import setup, find_packages
from typing import List


def install_requires() -> List[str]:
with open("./requirements.txt", "r") as f:
return f.read().split("\n")


setup(name="line4py",
version="1.0.0",
license="MIT",
description="LINE's library for Python",
author="R4zL",
url="https://github.com/7rs/line4py",
install_requires=install_requires(),
packages=find_packages(exclude=('example')))

0 comments on commit 2e35e2d

Please sign in to comment.