Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zahra Rajabi
tweepy
Commits
59f6634a
Commit
59f6634a
authored
Oct 18, 2010
by
Josh Roesslein
Browse files
Include all parameters when signing request for OAuth.
parent
a70c752a
Changes
1
Hide whitespace changes
Inline
Side-by-side
tweepy/streaming.py
View file @
59f6634a
...
...
@@ -83,12 +83,13 @@ class Stream(object):
self
.
api
=
API
()
self
.
headers
=
options
.
get
(
"headers"
)
or
{}
self
.
parameters
=
None
self
.
body
=
None
def
_run
(
self
):
# Authenticate
url
=
"%s://%s%s"
%
(
self
.
scheme
,
self
.
host
,
self
.
url
)
self
.
auth
.
apply_auth
(
url
,
'
GE
T'
,
self
.
headers
,
None
)
self
.
auth
.
apply_auth
(
url
,
'
POS
T'
,
self
.
headers
,
self
.
parameters
)
# Connect and process the stream
error_counter
=
0
...
...
@@ -166,6 +167,7 @@ class Stream(object):
self
.
_run
()
def
firehose
(
self
,
count
=
None
,
async
=
False
):
self
.
parameters
=
{
'delimited'
:
'length'
}
if
self
.
running
:
raise
TweepError
(
'Stream object already connected!'
)
self
.
url
=
'/%i/statuses/firehose.json?delimited=length'
%
STREAM_VERSION
...
...
@@ -174,12 +176,14 @@ class Stream(object):
self
.
_start
(
async
)
def
retweet
(
self
,
async
=
False
):
self
.
parameters
=
{
'delimited'
:
'length'
}
if
self
.
running
:
raise
TweepError
(
'Stream object already connected!'
)
self
.
url
=
'/%i/statuses/retweet.json?delimited=length'
%
STREAM_VERSION
self
.
_start
(
async
)
def
sample
(
self
,
count
=
None
,
async
=
False
):
self
.
parameters
=
{
'delimited'
:
'length'
}
if
self
.
running
:
raise
TweepError
(
'Stream object already connected!'
)
self
.
url
=
'/%i/statuses/sample.json?delimited=length'
%
STREAM_VERSION
...
...
@@ -188,19 +192,20 @@ class Stream(object):
self
.
_start
(
async
)
def
filter
(
self
,
follow
=
None
,
track
=
None
,
async
=
False
,
locations
=
None
):
params
=
{}
self
.
param
eter
s
=
{}
self
.
headers
[
'Content-type'
]
=
"application/x-www-form-urlencoded"
if
self
.
running
:
raise
TweepError
(
'Stream object already connected!'
)
self
.
url
=
'/%i/statuses/filter.json?delimited=length'
%
STREAM_VERSION
if
follow
:
params
[
'follow'
]
=
','
.
join
(
map
(
str
,
follow
))
self
.
param
eter
s
[
'follow'
]
=
','
.
join
(
map
(
str
,
follow
))
if
track
:
params
[
'track'
]
=
','
.
join
(
map
(
str
,
track
))
self
.
param
eter
s
[
'track'
]
=
','
.
join
(
map
(
str
,
track
))
if
locations
and
len
(
locations
)
>
0
:
assert
len
(
locations
)
%
4
==
0
params
[
'locations'
]
=
','
.
join
([
'%.2f'
%
l
for
l
in
locations
])
self
.
body
=
urllib
.
urlencode
(
params
)
self
.
parameters
[
'locations'
]
=
','
.
join
([
'%.2f'
%
l
for
l
in
locations
])
self
.
body
=
urllib
.
urlencode
(
self
.
parameters
)
self
.
parameters
[
'delimited'
]
=
'length'
self
.
_start
(
async
)
def
disconnect
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment