i need to send cookies to a website that i'm connecting to and i was told that i could use cachedhttp.py to accomplish this. i've tried searching and looking at the documentation but i still can't figure it out.
can anybody help me? all i want is to send some cookies (like 4) every time i connect with urllib. (or i could switch to urllib2 or whatever....)
SofaKng
Member+ Posts: 385 Joined: Mar 2005 Reputation: 0 |
2005-10-19 19:05
Post: #1
|
| find quote |
Bernd
Senior Member Joined: Mar 2005 Reputation: 0 |
2005-10-24 22:25
Post: #2
i encourage every xbmc script author to use cachedhttp.py!!!
its an easy and ready to use lib which provides lots of functionality ready to use incl cookies, user agent and timeouts. bernd |
| find quote |
SofaKng
Member+ Posts: 385 Joined: Mar 2005 Reputation: 0 |
2005-10-24 22:27
Post: #3
is there any documentation for this? (or really basic examples?)
i've taken a look at it but couldn't figure out how to use it... |
| find quote |
BigBellyBilly
Skilled Python Coder Posts: 959 Joined: Feb 2005 Reputation: 2 Location: UK |
2005-10-25 14:43
Post: #4
it can be done with urllib.urlopener()
Quote:cookies = [ |
| find quote |
SofaKng
Member+ Posts: 385 Joined: Mar 2005 Reputation: 0 |
2005-10-25 15:56
Post: #5
|
| find quote |
hattmall
Junior Member Posts: 32 Joined: Nov 2005 Reputation: 0 |
2008-12-11 16:34
Post: #6
can anyone post an updated code example. I am unable to get this to work. This is my first attempt at a python script and I am piecing together from tutorials, etc.
Quote:import xbmc, xbmcgui, urllib, urllib2 , re |
| find quote |
Banned Joined: Mar 2008 Location: England |
2008-12-11 16:38
Post: #7
Try this :
Code: import urllib2 |
| find quote |
hattmall
Junior Member Posts: 32 Joined: Nov 2005 Reputation: 0 |
2008-12-12 08:24
Post: #8
Now Have it working I think sending the cookie, but I need to be able to Retrieve the URL while sending the cookie.
This way I can store the file, or play it. Like the urllib.retrieve which will work, but will not pass the cookies. So I need the Urllib2 way to retrieve a file or whatever the method is.
(This post was last modified: 2008-12-12 09:13 by hattmall.)
|
| find quote |
hattmall
Junior Member Posts: 32 Joined: Nov 2005 Reputation: 0 |
2008-12-12 08:35
Post: #9
Ok, I managed to Make it Write the page Downloaded to a file.
To me this seems like a bad way to do it, because it will be dealing with large file 100 MEG Archrives, Large Video Files, etc and I want to stream them. What is the better way?? Can I have the file writing, as well as playing at the same time? Code Now looks like this: Code: def downloadURL(self,source, destination): Thank you for any help.
(This post was last modified: 2008-12-12 09:50 by hattmall.)
|
| find quote |
Banned Joined: Mar 2008 Location: England |
2008-12-12 14:49
Post: #10
Have you read my plugin tutorial ?
The set-cookie only gets the true cookie sent by the site, if it isnt there it will not be able to find it and cause an error. Copy the addlink def from one of my plugins then addlink(name you want to display, url of file, thumbnail) when you press (A) xbox or click(windows/other) it will stream the file.
(This post was last modified: 2008-12-12 14:52 by Voinage.)
|
| find quote |

Search
Help