{"id":19261963,"url":"https://github.com/hacksu/learnpythonviatweepy","last_synced_at":"2026-02-06T02:33:19.496Z","repository":{"id":149141531,"uuid":"107309808","full_name":"hacksu/LearnPythonViaTweepy","owner":"hacksu","description":"Walkthrough to learn Python on pythonanywhere.com. ","archived":false,"fork":false,"pushed_at":"2018-10-02T21:51:07.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-07-21T16:58:07.629Z","etag":null,"topics":["beginner","lesson"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hacksu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-17T18:41:41.000Z","updated_at":"2020-03-09T14:37:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"58570a3a-f103-46ba-8f80-1769583dd468","html_url":"https://github.com/hacksu/LearnPythonViaTweepy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hacksu/LearnPythonViaTweepy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacksu%2FLearnPythonViaTweepy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacksu%2FLearnPythonViaTweepy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacksu%2FLearnPythonViaTweepy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacksu%2FLearnPythonViaTweepy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hacksu","download_url":"https://codeload.github.com/hacksu/LearnPythonViaTweepy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacksu%2FLearnPythonViaTweepy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29145885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T01:13:33.096Z","status":"online","status_checked_at":"2026-02-06T02:00:08.092Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beginner","lesson"],"created_at":"2024-11-09T19:29:10.391Z","updated_at":"2026-02-06T02:33:19.480Z","avatar_url":"https://github.com/hacksu.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Learn Python Via Tweepy\n\nIf you're here just for the authorization code, skip down to **Authorizing Our Twitter App**\n\nToday we're going to learn the basics of Python, via [Python Anywhere](http://pythonanywhere.com).  Python is language that doesn't come on all computers, so Python Anywhere lets us use it without the pain of installing it manually. \n\n_If you're interested in installing Python on your local machine, you can do so [here](https://www.python.org/downloads/). it's worth noting that Mac OS has Python 2.7 preinstalled on their machines, but we'll be using Python 3.6. _\n\n## Setting Up Our Project\n\nFirst, we need to set up an account on [Python Anywhere](http://pythonanywhere.com). You don't even need to confirm your email.\n\nOnce you have an account, go to the Files tab, and make a new file called `myScriptName.py` (you can replace `myScriptName` with whatever, just make sure it ends in `.py`). \n\nWith the file open, let's walk through a basic example of a Python script.\n\nPython is a cool language that simplifies a lot of things about code. We won't go into detail about how python works in this tutorial, but here's a sample script that will iterate through 15 numbers, and output the square for all of those numbers, with a special message for number 10:\n\n```\nfor a in range(15):\n    b = a * a\n    if a == 10:\n        print (\"You should already know that 10 squared is 100, dummy!\")\n    else:\n        print (\"%d squared is equal to %d!\" % (a, b))\n```\n\nJust hit RUN to check it out!\n\n# Authorizing our Twitter App\n\n***IMPORTANT:*** **Twitter doesn't like spammy twitter profiles, and I don't want to get this account suspended!** I'm giving you authorization to post on the account, and ***every time you run api.update_status successfully,*** it will send out a tweet.  I'm asking that you please limit your posts to ***2 tweets per 10 minutes.*** The twitter limit is 100 tweets/hour, and I don't want us to get banned!\n\nHere's the twitter account this code is hooked up to: [@mic_drop_bot](https://twitter.com/Mic_Drop_Bot). I used him for an old old hackathon project. \n\nOnce you've read that, you may run the following code to tweet something:\n\n```\n# This line imports the library Tweepy, which is pre-installed in PythonAnywhere\nimport tweepy\n\n# I generated these keys at http://apps.twitter.com\n# Note that you need a twitter account with a validated phone number for this\n# Please don't abuse this info! \n#\nconsumer_key = 'msLJGoIZx7hMxWv6eszGGOBfi'\nconsumer_secret = 'azXQeRpFj9Wowfnrhj1M4CcMgVm5Kp9SXhppPNx26MfLHHivUA'\naccess_token = '3914186835-ml58nTscOP4TbwuDK1U2aA0YiA1PtlOjlUMPrJH'\naccess_token_secret = 'JqJdbB4Hj9U52iiEQ1yxDpn2xPxMs0wlx8i3ncCna75LE'\n\nauth = tweepy.OAuthHandler(consumer_key, consumer_secret)\nauth.set_access_token(access_token, access_token_secret)\napi = tweepy.API(auth)\n\n\n# Below are some examples of what we can now do -- just uncomment the relevant lines to run\n\ntweet = \"\"\"\nMy First Automated Tweet -- hello world!\n\"\"\"\n# Uncomment the next line to send the above tweet:\n\n# api.update_status(status=tweet)\n\n# Uncomment the next line to follow the twitter user @username:\n\n# api.create_friendship('username')\n\n# Uncomment the next 3 lines to print the last 20ish tweets from @_hacksu:\n\n# tweets = api.user_timeline('_hacksu')\n# for i in tweets:\n#     print (i.text)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhacksu%2Flearnpythonviatweepy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhacksu%2Flearnpythonviatweepy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhacksu%2Flearnpythonviatweepy/lists"}