django channels authentication over script
I have a Django Channel project and i want to connect to a Websocket over a script.
I am useing the code from the example
as a python websocket-client I use this
I get the cookies from login in over script this is the result
'csrftoken': 'NGl4QuroPpp41zzsxODqdNv7UoaOmrNdbYc5H7AwzHajvLsUrHVJmwj7K1fdwBcC', 'sessionid': '5ccdsjby3g65xtltdppcdi0h8mmlr7h0
and I am using it the webclient like this
ws = websocket.WebSocketApp("ws://127.0.0.1:8000/chat/stream/",
on_message=self.on_message,
on_error=self.on_error,
on_close=self.on_close,
cookie=cookies)
ws.on_open = self.on_open
ws.run_forever()
I don't know if the cookies are somehow wrong or I need to use anothe websocket client.
python django authentication websocket channels
add a comment |
I have a Django Channel project and i want to connect to a Websocket over a script.
I am useing the code from the example
as a python websocket-client I use this
I get the cookies from login in over script this is the result
'csrftoken': 'NGl4QuroPpp41zzsxODqdNv7UoaOmrNdbYc5H7AwzHajvLsUrHVJmwj7K1fdwBcC', 'sessionid': '5ccdsjby3g65xtltdppcdi0h8mmlr7h0
and I am using it the webclient like this
ws = websocket.WebSocketApp("ws://127.0.0.1:8000/chat/stream/",
on_message=self.on_message,
on_error=self.on_error,
on_close=self.on_close,
cookie=cookies)
ws.on_open = self.on_open
ws.run_forever()
I don't know if the cookies are somehow wrong or I need to use anothe websocket client.
python django authentication websocket channels
Why aren't you just using aWebsocketConsumer
? Is there any specific reason?
– Marked as Duplicate
Aug 15 '18 at 17:34
I am. If i wasn't clear. i want to connect over a external script which is separate from django and the WebsocketConsumer
– Zungen Katze
Aug 16 '18 at 19:21
add a comment |
I have a Django Channel project and i want to connect to a Websocket over a script.
I am useing the code from the example
as a python websocket-client I use this
I get the cookies from login in over script this is the result
'csrftoken': 'NGl4QuroPpp41zzsxODqdNv7UoaOmrNdbYc5H7AwzHajvLsUrHVJmwj7K1fdwBcC', 'sessionid': '5ccdsjby3g65xtltdppcdi0h8mmlr7h0
and I am using it the webclient like this
ws = websocket.WebSocketApp("ws://127.0.0.1:8000/chat/stream/",
on_message=self.on_message,
on_error=self.on_error,
on_close=self.on_close,
cookie=cookies)
ws.on_open = self.on_open
ws.run_forever()
I don't know if the cookies are somehow wrong or I need to use anothe websocket client.
python django authentication websocket channels
I have a Django Channel project and i want to connect to a Websocket over a script.
I am useing the code from the example
as a python websocket-client I use this
I get the cookies from login in over script this is the result
'csrftoken': 'NGl4QuroPpp41zzsxODqdNv7UoaOmrNdbYc5H7AwzHajvLsUrHVJmwj7K1fdwBcC', 'sessionid': '5ccdsjby3g65xtltdppcdi0h8mmlr7h0
and I am using it the webclient like this
ws = websocket.WebSocketApp("ws://127.0.0.1:8000/chat/stream/",
on_message=self.on_message,
on_error=self.on_error,
on_close=self.on_close,
cookie=cookies)
ws.on_open = self.on_open
ws.run_forever()
I don't know if the cookies are somehow wrong or I need to use anothe websocket client.
python django authentication websocket channels
python django authentication websocket channels
asked Aug 14 '18 at 19:45
Zungen KatzeZungen Katze
163
163
Why aren't you just using aWebsocketConsumer
? Is there any specific reason?
– Marked as Duplicate
Aug 15 '18 at 17:34
I am. If i wasn't clear. i want to connect over a external script which is separate from django and the WebsocketConsumer
– Zungen Katze
Aug 16 '18 at 19:21
add a comment |
Why aren't you just using aWebsocketConsumer
? Is there any specific reason?
– Marked as Duplicate
Aug 15 '18 at 17:34
I am. If i wasn't clear. i want to connect over a external script which is separate from django and the WebsocketConsumer
– Zungen Katze
Aug 16 '18 at 19:21
Why aren't you just using a
WebsocketConsumer
? Is there any specific reason?– Marked as Duplicate
Aug 15 '18 at 17:34
Why aren't you just using a
WebsocketConsumer
? Is there any specific reason?– Marked as Duplicate
Aug 15 '18 at 17:34
I am. If i wasn't clear. i want to connect over a external script which is separate from django and the WebsocketConsumer
– Zungen Katze
Aug 16 '18 at 19:21
I am. If i wasn't clear. i want to connect over a external script which is separate from django and the WebsocketConsumer
– Zungen Katze
Aug 16 '18 at 19:21
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51848766%2fdjango-channels-authentication-over-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51848766%2fdjango-channels-authentication-over-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why aren't you just using a
WebsocketConsumer
? Is there any specific reason?– Marked as Duplicate
Aug 15 '18 at 17:34
I am. If i wasn't clear. i want to connect over a external script which is separate from django and the WebsocketConsumer
– Zungen Katze
Aug 16 '18 at 19:21