cruisedevice / twweet-cli Goto Github PK
View Code? Open in Web Editor NEW:bird: Tweet right from your cli without even opening your browser.
License: MIT License
:bird: Tweet right from your cli without even opening your browser.
License: MIT License
└─$ 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]
└─$
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.
It seems when the follower list is queried, it just dumped the whole JSON data without parsing.
This doesn't seem nice.
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.
User:twweet-cli $ sudo python setup.py install
running install
Creating Data Directories...
Cannot create data dir the installation cannot continue..
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
A way to do this is by using a text file as mentioned here. http://stackoverflow.com/questions/24725345/how-to-make-python-remeber-permanently-a-variable-or-a-list-no-pickle. Or any other method.
Create a setup file for the application.
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.
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!
After getting tweets of user or getting tweets of particular hashtag, a csv file is created for each. These files are directly saved in the root of the project directory. There must be a separate directory for these files and they must be ignored by github.
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.
Get list of trending topics from twitter.
On first run, if there is no consumer key or OAuth token, the app should prompt to create them. Until this happens, all get and twweet operations will fail with Twitter API errors.
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.
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.
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.
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.
I messed around with the api some time ago, maybe i can help..
I'm unsure if this change would be welcome which is why I'm suggesting it as an idea. Please feel free to close if not something that will work for the project. I'd like to go in and change the function names to be lowercase and separate words in the names by underscores.
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.
A new branch is needed for maintaining code for python 3.6. Refer to #16 for more info.
We should probably write some unit test cases as well.
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 😄
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
Check the length of the tweet before sending it to twitter. Display an error message if tweets exceeds its length limit.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.