Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Readme
A simple type hinted Python client for interacting with Twitter's API.
pip -m install tweetipy
To use it, setup a developer account under developer.twitter.com.
After that, create an app from the developer dashboard and generate the needed tokens ("API Key and Secret").
Please note that the library does not yet implement the full Twitter API, but rather only some endpoints that are interesting for my projects. Also, although it is already working, please be aware that this library is still in early development phase and thus breaking changes might occur. In other words, don't rely on it for production just yet.
In any case, feel free to use it for your own projects. Do create issues if anything weird pops up. Pull requests and feature requests are welcome!
from tweetipy import Tweetipy
# Initialize client
ttpy = Tweetipy(
'YOUR_TWITTER_API_KEY',
'YOUR_TWITTER_API_KEY_SECRET')
# Post tweet to Twitter
tweet = ttpy.tweets.write("I'm using Twitter API!")
# See the uploaded tweet! :)
print(tweet)
from tweetipy import Tweetipy
from tweetipy.types import MediaToUpload
ttpy = Tweetipy(
'YOUR_TWITTER_API_KEY',
'YOUR_TWITTER_API_KEY_SECRET')
# First upload the media to Twitter.
with open('dog.jpeg', 'rb') as pic:
uploaded_media = ttpy.media.upload(
media_bytes=pic.read(),
media_type="image/jpeg")
# Then post a tweet, adding the media_id as a parameter.
ttpy.tweets.write(
"This tweet contains some media.",
media=MediaToUpload([uploaded_media.media_id_string]))
from tweetipy import Tweetipy
# Initialize the client
ttpy = Tweetipy(
'YOUR_TWITTER_API_KEY',
'YOUR_TWITTER_API_KEY_SECRET')
# Treat the 'query' argument as you would a search box.
search_results = ttpy.tweets.search(query='space separated keywords')
# See results 🤩
for tweet in search_results:
print(tweet)
from tweetipy import Tweetipy
from tweetipy.helpers import QueryBuilder
# Initialize the client
ttpy = Tweetipy(
'YOUR_TWITTER_API_KEY',
'YOUR_TWITTER_API_KEY_SECRET')
# The query builder is your friend :)
t = QueryBuilder()
# Define the search criteria using the query builder.
search_results = ttpy.tweets.search(
query=t.from_user('Randogs8'),
sort_order='recency'
)
# See results 🤩
for tweet in search_results:
print(tweet)
from tweetipy import Tweetipy
from tweetipy.helpers import QueryBuilder
# Initialize the client
ttpy = Tweetipy(
'YOUR_TWITTER_API_KEY',
'YOUR_TWITTER_API_KEY_SECRET')
# The query builder is your friend :)
t = QueryBuilder()
# Use the 'and' operator (&) to define alternative criteria.
# The query builder will do some background work for you so this works as
# expected. 😎
search_results = ttpy.tweets.search(
query=t.with_all_keywords(['dogs', 'love']) & t.has.media,
sort_order='relevancy'
)
# See the results 🤩
for tweet in search_results:
print(tweet)
from tweetipy import Tweetipy
from tweetipy.helpers import QueryBuilder
# Initialize the client
ttpy = Tweetipy(
'YOUR_TWITTER_API_KEY',
'YOUR_TWITTER_API_KEY_SECRET')
# The query builder is your friend :)
t = QueryBuilder()
# Use the pipe operator (|) to define alternative criteria.
# The query builder will do some background work for you so this works as
# expected. 😎
search_results = ttpy.tweets.search(
query=t.from_user('Randogs8') | t.from_user('cooldogfacts'),
sort_order='recency'
)
# See the results 🤩
for tweet in search_results:
print(tweet)
FAQs
A simple "type hinted" Python client for interacting with Twitter's API.
We found that tweetipy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.