-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from MirrorShih/master
feat: add command line
- Loading branch information
Showing
5 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import click | ||
from lotify.client import Client | ||
|
||
|
||
@click.group() | ||
def cli(): | ||
pass | ||
|
||
|
||
@cli.command() | ||
@click.option('-t', '--access_token', type=str, help='access token', required=True) | ||
@click.option('-m', '--message', type=str, help='message to send', required=True) | ||
@click.option('-u', '--image-url', type=str, help='image url to send', default="") | ||
@click.option('-f', '--image-file', type=str, help='image file path to send', default="") | ||
def send_message(message, access_token, image_url, image_file): | ||
client = Client() | ||
if image_url != "": | ||
client.send_message_with_image_url(access_token, message, image_url, image_url) | ||
elif image_file != "": | ||
client.send_message_with_image_file(access_token, message, open(image_file, 'rb')) | ||
else: | ||
client.send_message(access_token, message) | ||
click.echo("send successfully") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
requests>=2.0 | ||
urllib3 | ||
urllib3 | ||
click>=7.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters