Skip to content

Commit ea54376

Browse files
committed
Added quick Python API code
1 parent 6550be7 commit ea54376

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

.DS_Store

0 Bytes
Binary file not shown.

Twitter/twitterAPI_images.pptx

303 KB
Binary file not shown.

Twitter/twitterPython.ipynb

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"# To install do\n",
10+
"# pip install python-twitter"
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": 7,
16+
"metadata": {},
17+
"outputs": [],
18+
"source": [
19+
"import twitter\n",
20+
"\n",
21+
"ACCESS_TOKEN = ''\n",
22+
"ACCESS_SECRET = ''\n",
23+
"CONSUMER_KEY = ''\n",
24+
"CONSUMER_SECRET = ''\n",
25+
"\n",
26+
"t = twitter.Api(consumer_key=CONSUMER_KEY,\n",
27+
" consumer_secret=CONSUMER_SECRET,\n",
28+
" access_token_key=ACCESS_TOKEN,\n",
29+
" access_token_secret=ACCESS_SECRET)\n",
30+
"\n",
31+
"results = t.GetSearch(raw_query=\"q=from%3AGalarnykMichael&src=typd\")"
32+
]
33+
},
34+
{
35+
"cell_type": "code",
36+
"execution_count": 8,
37+
"metadata": {},
38+
"outputs": [],
39+
"source": [
40+
"results = t.GetSearch(raw_query=\"q=from%3AGalarnykMichael&src=typd\")"
41+
]
42+
},
43+
{
44+
"cell_type": "code",
45+
"execution_count": 11,
46+
"metadata": {},
47+
"outputs": [
48+
{
49+
"data": {
50+
"text/plain": [
51+
"[Status(ID=1054774887821144064, ScreenName=GalarnykMichael, Created=Tue Oct 23 16:41:44 +0000 2018, Text='@thestartup_ Thanks! I will submit something in the future!'),\n",
52+
" Status(ID=1054522320230871042, ScreenName=GalarnykMichael, Created=Mon Oct 22 23:58:07 +0000 2018, Text=\"RT @0xAmit: I've never met a single person that enjoys working in an open space office. There are a lot of people (myself included) with ma…\"),\n",
53+
" Status(ID=1053462978605965312, ScreenName=GalarnykMichael, Created=Sat Oct 20 01:48:41 +0000 2018, Text='@brianavecchione @CornellCIS @ioanauoft thanks for following up! Good to see them getting rid of that requirement!'),\n",
54+
" Status(ID=1053407353842749440, ScreenName=GalarnykMichael, Created=Fri Oct 19 22:07:39 +0000 2018, Text=\"@brianavecchione @CornellCIS @ioanauoft @brianavecchione I imagine it isn't showing up on the website yet because t… https://t.co/shBns6rJkW\"),\n",
55+
" Status(ID=1053407046630989824, ScreenName=GalarnykMichael, Created=Fri Oct 19 22:06:25 +0000 2018, Text='RT @brianavecchione: Important to note that @CornellCIS no longer requires the GRE! (was shown to be a significant factor in discouraging q…')]"
56+
]
57+
},
58+
"execution_count": 11,
59+
"metadata": {},
60+
"output_type": "execute_result"
61+
}
62+
],
63+
"source": [
64+
"results"
65+
]
66+
},
67+
{
68+
"cell_type": "code",
69+
"execution_count": null,
70+
"metadata": {},
71+
"outputs": [],
72+
"source": []
73+
}
74+
],
75+
"metadata": {
76+
"kernelspec": {
77+
"display_name": "Python 3",
78+
"language": "python",
79+
"name": "python3"
80+
},
81+
"language_info": {
82+
"codemirror_mode": {
83+
"name": "ipython",
84+
"version": 3
85+
},
86+
"file_extension": ".py",
87+
"mimetype": "text/x-python",
88+
"name": "python",
89+
"nbconvert_exporter": "python",
90+
"pygments_lexer": "ipython3",
91+
"version": "3.5.5"
92+
}
93+
},
94+
"nbformat": 4,
95+
"nbformat_minor": 1
96+
}

0 commit comments

Comments
 (0)