Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CouchPotatoServer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
CouchPotatoServer
Commits
0132dcff
Commit
0132dcff
authored
13 years ago
by
Ruud
Browse files
Options
Downloads
Patches
Plain Diff
Proper module update
Conflicts: couchpotato/core/notifications/twitter/main.py
parent
d29fd629
Branches
pip
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
couchpotato/core/notifications/twitter/main.py
+6
-6
6 additions, 6 deletions
couchpotato/core/notifications/twitter/main.py
with
6 additions
and
6 deletions
couchpotato/core/notifications/twitter/main.py
+
6
−
6
View file @
0132dcff
from
couchpotato.api
import
addApiView
from
couchpotato.core.helpers.encoding
import
tryUrlencode
from
couchpotato.core.helpers.request
import
jsonified
,
getParam
from
couchpotato.core.helpers.variable
import
cleanHost
from
couchpotato.core.logger
import
CPLog
from
couchpotato.core.notifications.base
import
Notification
from
flask.helpers
import
url_for
from
pytwitter
import
Api
,
parse_qsl
from
werkzeug.utils
import
redirect
import
oauth2
import
twitter
as
pytwitter
import
urllib
log
=
CPLog
(
__name__
)
...
...
@@ -34,7 +34,7 @@ class Twitter(Notification):
def
notify
(
self
,
message
=
''
,
data
=
{}):
if
self
.
isDisabled
():
return
api
=
Api
(
self
.
consumer_key
,
self
.
consumer_secret
,
self
.
conf
(
'
access_token_key
'
),
self
.
conf
(
'
access_token_secret
'
))
api
=
pytwitter
.
Api
(
self
.
consumer_key
,
self
.
consumer_secret
,
self
.
conf
(
'
access_token_key
'
),
self
.
conf
(
'
access_token_secret
'
))
mention
=
self
.
conf
(
'
mention
'
)
if
mention
:
...
...
@@ -56,7 +56,7 @@ class Twitter(Notification):
oauth_consumer
=
oauth2
.
Consumer
(
self
.
consumer_key
,
self
.
consumer_secret
)
oauth_client
=
oauth2
.
Client
(
oauth_consumer
)
resp
,
content
=
oauth_client
.
request
(
self
.
urls
[
'
request
'
],
'
POST
'
,
body
=
tryU
rlencode
({
'
oauth_callback
'
:
callback_url
}))
resp
,
content
=
oauth_client
.
request
(
self
.
urls
[
'
request
'
],
'
POST
'
,
body
=
urllib
.
u
rlencode
({
'
oauth_callback
'
:
callback_url
}))
if
resp
[
'
status
'
]
!=
'
200
'
:
log
.
error
(
'
Invalid response from Twitter requesting temp token: %s
'
%
resp
[
'
status
'
])
...
...
@@ -64,7 +64,7 @@ class Twitter(Notification):
'
success
'
:
False
,
})
else
:
self
.
request_token
=
dict
(
parse_qsl
(
content
))
self
.
request_token
=
dict
(
pytwitter
.
parse_qsl
(
content
))
auth_url
=
self
.
urls
[
'
authorize
'
]
+
(
"
?oauth_token=%s
"
%
self
.
request_token
[
'
oauth_token
'
])
...
...
@@ -85,7 +85,7 @@ class Twitter(Notification):
oauth_client
=
oauth2
.
Client
(
oauth_consumer
,
token
)
resp
,
content
=
oauth_client
.
request
(
self
.
urls
[
'
access
'
],
method
=
'
POST
'
,
body
=
'
oauth_verifier=%s
'
%
key
)
access_token
=
dict
(
parse_qsl
(
content
))
access_token
=
dict
(
pytwitter
.
parse_qsl
(
content
))
if
resp
[
'
status
'
]
!=
'
200
'
:
log
.
error
(
'
The request for an access token did not succeed: %s
'
%
resp
[
'
status
'
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment