Skip to content

Contribution-DAO/citydao-python

Repository files navigation

CityDAO Utility Bot + Python package

A utility python package to fetch **everything** about CityDAO's info.

🧰 Dependencies

  • Python >= 3.10

🫕 Installation

From source
  1. Activate virtual environment (Optional)

    python3 -m venv citydao.venv
    source citydao.venv/bin/activate
  2. Install via setup.py

    python setup.py install
From pypi

TBD

💻 Usage

There are 4 main usage for this repository

Prepare .env files

Prepare .env files according to what was shown in .env.example.

  • Get google API key here
  • Get twitter API key/secret here
  • Get telegram API key for bot here
  • Get Spotify Client ID and credentials here
🤖 Run a telegram bot

Please see example at run_bot.py

📟 Fetch latest tweets
from citydao.tweets import CityDAOTwitter


apikey = "your_twitter_apikey"
api_secret = "your_twitter_api_secret"
twitter = CityDAOTwitter(apikey, api_secret)
tweets = twitter.fetch_recent_tweets()
today_tweets = twitter.filter_today_tweets(tweets)
🗓 Fetch calendar events
from citydao.calendar import CityDAOCalendar

google_apikey = "your_google_api_key"
calendar = CityDAOCalendar(google_apikey=google_apikey)

today_events = calendar.get_today_events()
📻 Get CityDAO's Podcast Episodes
from citydao.spotify import CityDAOSpotify

spotify_client_id, spotify_client_credentials = "your_spotify_client_id", "your_spotify_credentials"
citydao_spotify = CityDAOSpotify(spotify_client_id, spotify_client_credentials)
episodes = citydao_spotify.get_latest_episodes()
🏦 Get current treasury balance
from citydao.treasury import CityDAOTreasury

treasury = CityDAOTreasury()
balance = treasury.get_balance()

# balance = {
#   "WETH": XXX,
#   "USDC": YYY,
#   "ETH": ZZZ
# }
🗳 Get CityDAO's proposals
from citydao.snapshot import SnapshotAPI, ProposalStatus

snapshot = SnapshotAPI()
proposals = snapshot.get_proposals()
active_proposals = snapshot.get_proposals(status=ProposalStatus.ACTIVE)
closed_proposals = snapshot.get_proposals(status=ProposalStatus.CLOSED)

for proposal in proposals:
    # get detailed votes for each proposal
    votes = proposal.get_votes()

🔬 Contributing

Feels free to fork this repository and create a pull request!

🧙‍♂️ Author

chompk.eth | Contribution DAO#9502

About

CityDAO utility python package. Just for Fun :D

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published