Created
April 16, 2020 19:02
-
-
Save vchrombie/e6b547e78432acdb2de64454b2c7bf91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/home/p0tt3r/chaoss/sources/VENV_DIR/bin/python /home/p0tt3r/chaoss/zulip/script.py | |
{'anchor': 10000000000000000, | |
'found_anchor': False, | |
'found_newest': True, | |
'found_oldest': True, | |
'history_limited': False, | |
'messages': [{'avatar_url': 'https://zulip-avatars.s3.amazonaws.com/1000/1cd87892343b6620726b112851f0b66cbda4a68f?x=x&version=4', | |
'client': 'Internal', | |
'content': '<p>Welcome to <a class="stream" ' | |
'data-stream-id="187177" ' | |
'href="/#narrow/stream/187177-importlib">#importlib</a>.</p>', | |
'content_type': 'text/html', | |
'display_recipient': 'importlib', | |
'flags': ['read', 'historical'], | |
'id': 159280404, | |
'is_me_message': False, | |
'reactions': [], | |
'recipient_id': 303900, | |
'sender_email': 'welcome-bot@zulip.com', | |
'sender_full_name': 'Welcome Bot', | |
'sender_id': 100007, | |
'sender_realm_str': 'zulipcore', | |
'sender_short_name': 'welcome-bot', | |
'stream_id': 187177, | |
'subject': 'hello', | |
'submessages': [], | |
'timestamp': 1551022959, | |
'topic_links': [], | |
'type': 'stream'}, | |
{'avatar_url': None, | |
'client': 'ZulipElectron', | |
'content': '<p><span class="user-mention" ' | |
'data-user-id="209389">@Steven Ma</span> Try this in ' | |
'a <code>Dockerfile</code>:</p>\n' | |
'<div class="codehilite"><pre><span></span>FROM ' | |
'ubuntu:bionic\n' | |
'\n' | |
'RUN apt update\n' | |
'RUN apt upgrade -y\n' | |
'RUN apt install -y python3 python3-dev python3-venv ' | |
'python3-pip\n' | |
'RUN python3 -m pip install -U pip tox pip-run\n' | |
'</pre></div>', | |
'content_type': 'text/html', | |
'display_recipient': 'importlib', | |
'flags': ['read', 'historical'], | |
'id': 159281179, | |
'is_me_message': False, | |
'reactions': [], | |
'recipient_id': 303900, | |
'sender_email': 'jaraco@jaraco.com', | |
'sender_full_name': 'Jason R. Coombs', | |
'sender_id': 113001, | |
'sender_realm_str': 'python', | |
'sender_short_name': 'jaraco', | |
'stream_id': 187177, | |
'subject': 'Testing on Linux in docker', | |
'submessages': [], | |
'timestamp': 1551024348, | |
'topic_links': [], | |
'type': 'stream'}, | |
{'avatar_url': None, | |
'client': 'ZulipElectron', | |
'content': '<p>Build with <code>docker build . -t py3tox</code> ' | |
'Then run with <code>docker run -it py3tox -v ' | |
'...</code></p>', | |
'content_type': 'text/html', | |
'display_recipient': 'importlib', | |
'flags': ['read', 'historical'], | |
'id': 159281235, | |
'is_me_message': False, | |
'reactions': [], | |
'recipient_id': 303900, | |
'sender_email': 'jaraco@jaraco.com', | |
'sender_full_name': 'Jason R. Coombs', | |
'sender_id': 113001, | |
'sender_realm_str': 'python', | |
'sender_short_name': 'jaraco', | |
'stream_id': 187177, | |
'subject': 'Testing on Linux in docker', | |
'submessages': [], | |
'timestamp': 1551024420, | |
'topic_links': [], | |
'type': 'stream'}, | |
{'avatar_url': None, | |
'client': 'ZulipElectron', | |
'content': "<p>Or even better, don't bother with that " | |
'Dockerfile.</p>', | |
'content_type': 'text/html', | |
'display_recipient': 'importlib', | |
'flags': ['read', 'historical'], | |
'id': 159281899, | |
'is_me_message': False, | |
'reactions': [], | |
'recipient_id': 303900, | |
'sender_email': 'jaraco@jaraco.com', | |
'sender_full_name': 'Jason R. Coombs', | |
'sender_id': 113001, | |
'sender_realm_str': 'python', | |
'sender_short_name': 'jaraco', | |
'stream_id': 187177, | |
'subject': 'Testing on Linux in docker', | |
'submessages': [], | |
'timestamp': 1551025646, | |
'topic_links': [], | |
'type': 'stream'}, | |
{'avatar_url': None, | |
'client': 'ZulipElectron', | |
'content': '<p>Instead run <code>docker run -it -v ... ' | |
'jaraco/py37-tox</code>.</p>', | |
'content_type': 'text/html', | |
'display_recipient': 'importlib', | |
'edit_history': [{'prev_content': 'Instead run `docker run -it ' | |
'jaraco/py37-tox -v ...`.', | |
'prev_rendered_content': '<p>Instead run ' | |
'<code>docker run ' | |
'-it jaraco/py37-tox ' | |
'-v ...</code>.</p>', | |
'prev_rendered_content_version': 1, | |
'timestamp': 1551025941, | |
'user_id': 113001}], | |
'flags': ['read', 'historical'], | |
'id': 159281902, | |
'is_me_message': False, | |
'last_edit_timestamp': 1551025941, | |
'reactions': [], | |
'recipient_id': 303900, | |
'sender_email': 'jaraco@jaraco.com', | |
'sender_full_name': 'Jason R. Coombs', | |
'sender_id': 113001, | |
'sender_realm_str': 'python', | |
'sender_short_name': 'jaraco', | |
'stream_id': 187177, | |
'subject': 'Testing on Linux in docker', | |
'submessages': [], | |
'timestamp': 1551025661, | |
'topic_links': [], | |
'type': 'stream'}, | |
{'avatar_url': None, | |
'client': 'ZulipElectron', | |
'content': '<p>Hey Jason,<br>\n' | |
"If you think you'll be coming back decently soon " | |
'let me know. If not, I might just leave and then we ' | |
'can continue to contact each other through this ' | |
'thread.</p>', | |
'content_type': 'text/html', | |
'display_recipient': 'importlib', | |
'flags': ['read', 'historical'], | |
'id': 159284211, | |
'is_me_message': False, | |
'reactions': [], | |
'recipient_id': 303900, | |
'sender_email': 'stevenjma@gmail.com', | |
'sender_full_name': 'Steven Ma', | |
'sender_id': 209389, | |
'sender_realm_str': 'python', | |
'sender_short_name': 'stevenjma', | |
'stream_id': 187177, | |
'subject': 'Testing on Linux in docker', | |
'submessages': [], | |
'timestamp': 1551029804, | |
'topic_links': [], | |
'type': 'stream'}, | |
{'avatar_url': None, | |
'client': 'ZulipElectron', | |
'content': '<div class="codehilite"><pre><span></span>{\n' | |
' str(self.site_dir / ' | |
'"distinfo_pkg...dist-info": {\n' | |
' "METADATA": self.metadata,\n' | |
' "RECORD": "mod.py\\n",\n' | |
'\n' | |
' },\n' | |
' "mod.py": """\n' | |
' def main():\n' | |
' print("hello world")\n' | |
' """,\n' | |
'}\n' | |
'</pre></div>', | |
'content_type': 'text/html', | |
'display_recipient': 'importlib', | |
'flags': ['read', 'historical'], | |
'id': 159289082, | |
'is_me_message': False, | |
'reactions': [], | |
'recipient_id': 303900, | |
'sender_email': 'jaraco@jaraco.com', | |
'sender_full_name': 'Jason R. Coombs', | |
'sender_id': 113001, | |
'sender_realm_str': 'python', | |
'sender_short_name': 'jaraco', | |
'stream_id': 187177, | |
'subject': 'Testing on Linux in docker', | |
'submessages': [], | |
'timestamp': 1551038048, | |
'topic_links': [], | |
'type': 'stream'}, | |
{'avatar_url': None, | |
'client': 'ZulipElectron', | |
'content': '<p><a ' | |
'href="/user_uploads/3607/XRldRB3uISNBAF--cSFq75k1/pasted_image.png" ' | |
'target="_blank" title="pasted_image.png">pasted ' | |
'image</a> <br>\n' | |
"Well, codecov doesn't like me it seems. Feel free " | |
'to give instruction here in terms of the sort of ' | |
"CPython work you'd like me to do.</p>\n" | |
'<div class="message_inline_image"><a ' | |
'href="/user_uploads/3607/XRldRB3uISNBAF--cSFq75k1/pasted_image.png" ' | |
'target="_blank" title="pasted image"><img ' | |
'src="/user_uploads/3607/XRldRB3uISNBAF--cSFq75k1/pasted_image.png"></a></div>', | |
'content_type': 'text/html', | |
'display_recipient': 'importlib', | |
'flags': ['read', 'historical'], | |
'id': 159300050, | |
'is_me_message': False, | |
'reactions': [], | |
'recipient_id': 303900, | |
'sender_email': 'stevenjma@gmail.com', | |
'sender_full_name': 'Steven Ma', | |
'sender_id': 209389, | |
'sender_realm_str': 'python', | |
'sender_short_name': 'stevenjma', | |
'stream_id': 187177, | |
'subject': 'Testing on Linux in docker', | |
'submessages': [], | |
'timestamp': 1551047725, | |
'topic_links': [], | |
'type': 'stream'}, | |
{'avatar_url': None, | |
'client': 'ZulipElectron', | |
'content': '<p><span class="user-mention" ' | |
'data-user-id="209389">@Steven Ma</span> That error ' | |
'happens to every contributor, unfortunately. I ' | |
'should file a ticket about it. Your work was ' | |
'fine.</p>', | |
'content_type': 'text/html', | |
'display_recipient': 'importlib', | |
'flags': ['read', 'historical'], | |
'id': 159310770, | |
'is_me_message': False, | |
'reactions': [], | |
'recipient_id': 303900, | |
'sender_email': 'jaraco@jaraco.com', | |
'sender_full_name': 'Jason R. Coombs', | |
'sender_id': 113001, | |
'sender_realm_str': 'python', | |
'sender_short_name': 'jaraco', | |
'stream_id': 187177, | |
'subject': 'Testing on Linux in docker', | |
'submessages': [], | |
'timestamp': 1551066955, | |
'topic_links': [], | |
'type': 'stream'}, | |
{'avatar_url': None, | |
'client': 'ZulipElectron', | |
'content': "<p>Awesome, glad to know my code wasn't faulty. I " | |
"saw your message on the repo for issue 47; I'll " | |
"probably get to it in a couple days as I'm pretty " | |
'drained right now.</p>', | |
'content_type': 'text/html', | |
'display_recipient': 'importlib', | |
'flags': ['read', 'historical'], | |
'id': 159310824, | |
'is_me_message': False, | |
'reactions': [], | |
'recipient_id': 303900, | |
'sender_email': 'stevenjma@gmail.com', | |
'sender_full_name': 'Steven Ma', | |
'sender_id': 209389, | |
'sender_realm_str': 'python', | |
'sender_short_name': 'stevenjma', | |
'stream_id': 187177, | |
'subject': 'Testing on Linux in docker', | |
'submessages': [], | |
'timestamp': 1551067006, | |
'topic_links': [], | |
'type': 'stream'}, | |
{'avatar_url': None, | |
'client': 'ZulipMobile', | |
'content': '<p>Hi <span class="user-mention" ' | |
'data-user-id="112547">@Barry Warsaw</span> . If you ' | |
'have some time today, would you review the MRs in ' | |
'importlib_metadata? There are four. I’m planning to ' | |
'merge those tomorrow (including port to ' | |
'CPython).</p>', | |
'content_type': 'text/html', | |
'display_recipient': 'importlib', | |
'flags': ['read', 'historical'], | |
'id': 175270341, | |
'is_me_message': False, | |
'reactions': [], | |
'recipient_id': 303900, | |
'sender_email': 'jaraco@jaraco.com', | |
'sender_full_name': 'Jason R. Coombs', | |
'sender_id': 113001, | |
'sender_realm_str': 'python', | |
'sender_short_name': 'jaraco', | |
'stream_id': 187177, | |
'subject': 'Core sprint refresh', | |
'submessages': [], | |
'timestamp': 1568054275, | |
'topic_links': [], | |
'type': 'stream'}, | |
{'avatar_url': None, | |
'client': 'ZulipElectron', | |
'content': '<blockquote>\n' | |
'<p>Hi <span class="user-mention silent" ' | |
'data-user-id="112547">Barry Warsaw</span> . If you ' | |
'have some time today, would you review the MRs in ' | |
'importlib_metadata? There are four. I’m planning to ' | |
'merge those tomorrow (including port to ' | |
'CPython).</p>\n' | |
'</blockquote>\n' | |
'<p>Done! Some I straight up approved, and others ' | |
'I had some comments.</p>', | |
'content_type': 'text/html', | |
'display_recipient': 'importlib', | |
'flags': ['read', 'historical'], | |
'id': 175296917, | |
'is_me_message': False, | |
'reactions': [{'emoji_code': '2764', | |
'emoji_name': 'heart', | |
'reaction_type': 'unicode_emoji', | |
'user': {'email': 'jaraco@jaraco.com', | |
'full_name': 'Jason R. Coombs', | |
'id': 113001}}], | |
'recipient_id': 303900, | |
'sender_email': 'barry@python.org', | |
'sender_full_name': 'Barry Warsaw', | |
'sender_id': 112547, | |
'sender_realm_str': 'python', | |
'sender_short_name': 'barry', | |
'stream_id': 187177, | |
'subject': 'Core sprint refresh', | |
'submessages': [], | |
'timestamp': 1568076835, | |
'topic_links': [], | |
'type': 'stream'}], | |
'msg': '', | |
'result': 'success'} | |
Process finished with exit code 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import json | |
from pprint import pprint | |
args = ['curl', | |
'-sSX', | |
'GET', | |
'-G', | |
'https://python.zulipchat.com/api/v1/messages', | |
'-u', | |
'BOT_EMAIL_ADDRESS:BOT_API_KEY', | |
'-d', | |
'anchor=newest', | |
'-d', | |
'num_before=20', | |
'-d', | |
'num_after=0', | |
'-d', | |
'client_gravatar=true', | |
'--data-urlencode', | |
'narrow='+'[{"operand": "importlib", "operator": "stream"}]' | |
] | |
process = subprocess.Popen(args, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
stdout, stderr = process.communicate() | |
pprint(json.loads(stdout.decode('ascii'))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment