Giter Site home page Giter Site logo

twweet-cli's Introduction

twweet-cli

Tweet right from your cli without even opening your browser.

Join the chat at https://gitter.im/twweet-cli/Lobby Build Status

Install

pip install twweet-cli

Build from Source

Clone the source

$ git clone https://github.com/CruiseDevice/twweet-cli.git

Navigate to the tweet-cli folder

$ cd twweet-cli

Now run setup.py file.

For Linux users: $ sudo python3 setup.py install

For Windows users: $ python setup.py install

Create a Twitter "App"

Log in to https://apps.twitter.com/ to create a new app and generate your OAuth credentials:

  • Consumer Key (API Key)
  • Consumer Secret (API Secret)
  • Access Token
  • Access Token Secret

Run the application

$ twweet-cli

Note: Requires Python 3.x

Usage

  • type twweet to post a tweet.
  • type get to get different types of information from twitter. A menu will be provided to choose for your choice of information.
  • type edit to change your Ouath credentials.
  • type 99 to quit the application.

Contributing

I appreciate any help and support. Feel free to fork and create a pull request

Features present

  • tweet from your CLI without opening the browser.
  • Changing Consumer Key Consumer Secret Access Token Access Token Secret keys for twweet-cli.
  • getting the tweets of any user by providing the username.
  • getting the tweets of a particular hashtag by providing the same.
  • getting the trending topics on twitter.
  • getting the tweets in your timeline.
  • getting your follower list and their respective user name on twitter(number of followers to be displayed can be assigned).
  • getting your own tweets(number of tweets to be displayed can be assigned).

twweet-cli's People

Contributors

0x006e avatar blackbird71sr avatar blavejr avatar brandonmbanks avatar cruisedevice avatar dibyasonu avatar ediamondscience avatar griffintaur avatar jgarciabu avatar kalbhor avatar mblissmer avatar moyamanuel avatar p53ud0k0d3 avatar pulkitmaloo avatar shrey97 avatar tac-tics avatar thakkardharmik avatar tterb avatar weijuly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twweet-cli's Issues

Python3.6 refactor?

I mentioned this in #14 but this is probably a big enough proposition to warrant it's own thread. I'm a little confused as to why this project is being written in legacy code. I've refactored and tested twweet-cli.py and it seems to work just fine (I didn't test every function but it is still able to tweet and read tweets). Please let me know what you think and if you'd like to go through with a refactor.

Check tweet length

Check the length of the tweet before sending it to twitter. Display an error message if tweets exceeds its length limit.

Unable to run twweet-cli

I followed the instruction in the README file : Cloned the repo, made a python3 virtual environment, installed tweepy (Also needed to install pyyaml). Then when I ran twweet-cli , as expected, I was asked the Consumer Key and the Access Token credentials, which I duly entered after creating a Twitter App.
After this, when I run twweet-cli or twweet-cli --help or twweet-cli -h or twweet-cli help I get the following error:
Traceback (most recent call last): File "/home/user/.virtualenvs/env3/bin/twweet-cli", line 11, in <module> load_entry_point('twweet-cli==1.0.0', 'console_scripts', 'twweet-cli')() File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/pkg_resources/__init__.py", line 476, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2700, in load_entry_point return ep.load() File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2318, in load return self.resolve() File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2324, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/twweet_cli/main.py", line 1, in <module> from .Twweeter import Twweeter File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/twweet_cli/Twweeter.py", line 10, in <module> Configuration = ConfigurationReader() File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/twweet_cli/config/ConfigReader.py", line 17, in __init__ cfg = yaml.load(ymlfile) File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/yaml/__init__.py", line 72, in load return loader.get_single_data() File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/yaml/constructor.py", line 35, in get_single_data node = self.get_single_node() File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/yaml/composer.py", line 36, in get_single_node document = self.compose_document() File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/yaml/composer.py", line 58, in compose_document self.get_event() File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/yaml/parser.py", line 118, in get_event self.current_event = self.state() File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/yaml/parser.py", line 193, in parse_document_end token = self.peek_token() File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/yaml/scanner.py", line 128, in peek_token self.fetch_more_tokens() File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/yaml/scanner.py", line 220, in fetch_more_tokens return self.fetch_value() File "/home/user/.virtualenvs/env3/lib/python3.5/site-packages/yaml/scanner.py", line 576, in fetch_value self.get_mark()) yaml.scanner.ScannerError: mapping values are not allowed here in "/home/user/.twweet-cli/data/config.yml", line 4, column 19

Unable to proceed further.

setup.py

Create a setup file for the application.

Windows instructions

I know this is knit-picky, but the Windows instructions for running the setup.py script in the ReadMe are:

For Windows users: $ sudo python setup.py install
sudo should be left out since it's not a Windows command.

Also, it's been a while since I've used python on Window, so correct me if I'm wrong, but when running pip, I believe they would need to type python -m pip install tweepy
I can verify this one later tonight.

Add nice formatting for timeline/searched tweets?

Hey all, I was wondering if someone might take on having some kind of formatting settings or adjustments to make viewing your timeline or your own tweets easier to read. Currently everything is just output as a large list of tweets with attributes showing. Perhaps we could have some sort of filter function to pair this down and get it into a more readable state? It would be nice if it took parameters so that the user could have some settings regarding how things are displayed.

If TwtApi.db is empty, everything fails

After running setup, I started a twweet-cli session. Instead of completing it, I pressed Ctrl-C before running any real operations.

After that, it was impossible to relaunch the app:

python -m twweet_cli                                                                       git:(master|✚1
Traceback (most recent call last):
  File "/opt/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/opt/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/apiper/Development/github/twweet-cli/twweet_cli.py", line 185, in <module>
    main()
  File "/Users/apiper/Development/github/twweet-cli/twweet_cli.py", line 143, in main
    cfgdb = list(c.fetchone())
TypeError: 'NoneType' object is not iterable

Re-running the setup had no effect.

I had to open TwtApi.db with a SQLlite editor, and add a line of dummy values to the database. Once it was "fixed", I could run the CLI again.

I'm guessing that force closing the Python program causes the SQLlite DB to be closed non-cleanly and future runs fail. Setup could either pre-populate the file with dummy values, or this error condition should be handled more cleanly.

Make class

I suggest we put the code in a class, in case we want to add other functionality later we can have "add-ons" separated from the core programme. plus it's a little more organised that way.

setup.py failing @ os.chmod

Traceback (most recent call last):
File "setup.py", line 92, in
'twweet-cli = twweet_cli:main',
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "setup.py", line 25, in run
createCreds()
File "setup.py", line 53, in createCreds
os.chmod(home+"/.twweet-cli/data/creds.json")
TypeError: Required argument 'mode' (pos 2) not found

setup.py fails with NameError while creating data directories

User:twweet-cli $ sudo python setup.py install
Password:
running install
Creating Data Directories...
Enter your Consumer Key: kub6U1JlLscNSchFseOoSwLRaancn
Traceback (most recent call last):
  File "setup.py", line 87, in <module>
    'twweet-cli = twweet_cli:main',
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "setup.py", line 24, in run
    createCreds()
  File "setup.py", line 38, in createCreds
    ck = input('Enter your Consumer Key: ').strip()
  File "<string>", line 1, in <module>
NameError: name 'kub6U1JlLscNSchFseOoSwLRaancn' is not defined

Broken setup.py - [Fix Needed]

The following PR(s) broke the setup.py:
[x] #50 - Modularizing the code.
So there should be changes needed to fix this. Now the program contains 4 files instead of 1 file.And the old file twweet_cli.py should be removed as there is no need of it now.

Add stream listener

Hi guys I took a look at your project and it's pretty interesting, I would like to help as well.
I was thinking why dont we add a stream listener so the user can get a constant stream of the latest tweets like on the twitter website or app without worrying about rate limits or downloading the same data over and over again.

I have started adding the stream listener to the project in my forked version, please take a look at it.

Runtime error

└─$ twweet-cli
Traceback (most recent call last):
  File "/usr/local/bin/twweet-cli", line 33, in <module>
    sys.exit(load_entry_point('twweet-cli==2.1.0', 'console_scripts', 'twweet-cli')())
  File "/usr/local/bin/twweet-cli", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/lib/python3.10/dist-packages/twweet_cli-2.1.0-py3.10.egg/twweet_cli/main.py", line 5, in <module>
  File "/usr/local/lib/python3.10/dist-packages/twweet_cli-2.1.0-py3.10.egg/twweet_cli/Listener.py", line 6, in <module>
AttributeError: module 'tweepy' has no attribute 'StreamListener'
                                                                                                                    
┌──(yolo㉿wisebits)-[~/…/twweet-cli/build/lib/twweet_cli]
└─$ neofetch
..............                                     yolo@wisebits 
            ..,;:ccc,.                             ------------- 
          ......''';lxO.                           OS: Kali GNU/Linux Rolling x86_64 
.....''''..........,:ld;                           Kernel: 5.18.0-kali5-amd64 
           .';;;:::;,,.x,                          Uptime: 5 hours, 42 mins 
      ..'''.            0Xxoc:,.  ...              Packages: 4207 (dpkg) 
  ....                ,ONkc;,;cokOdc',.            Shell: zsh 5.9 
 .                   OMo           ':ddo.          Resolution: 1024x768, 1440x900 
                    dMc               :OO;         DE: Plasma 5.25.3 
                    0M.                 .:o.       WM: KWin 
                    ;Wd                            WM Theme: Breeze 
                     ;XO,                          Theme: [Plasma], Breeze [GTK2/3] 
                       ,d0Odlc;,..                 Icons: breeze-dark [Plasma], breeze-dark [GTK2/3] 
                           ..',;:cdOOd::,.         Terminal: konsole 
                                    .:d;.':;.      CPU: 11th Gen Intel i7-11700 (16) @ 4.800GHz 
                                       'd,  .'     GPU: Intel RocketLake-S GT1 [UHD Graphics 750] 
                                         ;l   ..   Memory: 7302MiB / 15768MiB 
                                          .o
                                            c                              
                                            .'                             
                                             .

                                                                                                                    
┌──(yolo㉿wisebits)-[~/…/twweet-cli/build/lib/twweet_cli]
└─$ 

Test Cases

We should probably write some unit test cases as well.

Difference in key names between ConfigReader and setup

There is a difference between the key names used in the config.yml file created via setup.py (key names are Tweets and HashTag here) and in the ConfigReader (key names are tweets and hashtag here). This results in:

  File "/Users/gganesan/mac/code/pub-github/weijuly/twweet-cli/twweet_cli/config/ConfigReader.py", line 18, in __init__
    ConfigurationReader.__tweets = cfg['tweets']
KeyError: 'tweets'

Let me know if I can issue a PR to resolve this.

PS: I'm very new to open source contribution - it'd be great to get some guidance and mentorship 😄

twweet-cli command doesn't work anymore.

twweet-cli-command-error
twweet-cli command which was meant to run the application directly from anywhere instead of doing python3 twweet-cli.py does not work anymore. I have added the screenshot below of the error it is showing after running the command for the reference. @nithinswarrier can you please check it and confirm.

setup.py: cannot create data dir

User:twweet-cli $ sudo python setup.py install
running install
Creating Data Directories...
Cannot create data dir the installation cannot continue..

After command, return to main menu

It would be nice to stay in the program until you tell it you want to quit. Basically after doing a thing ("show my tweets" etc), it should drop you back to the main menu to make another selection. Also if we're doing that, a "quit" option should be added too!

I'm happy to do this one if you guys don't already have it in the works!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.