Jump to content


Photo

Python Scripts And Http Proxies Blues


  • Please log in to reply
5 replies to this topic

#1 rodol

rodol

    X-S Enthusiast

  • Members
  • 9 posts
  • Location:Madrid SPAIN
  • Interests:LoWLeVeL
  • Xbox Version:v1.1
  • 360 version:none

Posted 09 April 2007 - 11:45 AM

Hi!

I've spent the last nights installing Python scripts to my XBMC. My setup: A linux computer proxies HTTP to the XBOX. It also proxies DNS server and hosts the XLINK/KAI server.

The problem: All python scripts I downloaded do not work with a HTTP proxy.


I know there is a way to define the proxy in an "environment variable" ("HTTP_PROXY") so all urllib and urllib2 methods read and use it accordingly (read it on python.org). However, I don't know where to define that environment variables in the XBOX platform. Anybody can help me out?


Meanwhile, I managed to modify the following scripts to work with my proxy server. The proxy address is hardcoded on each python script I modified. Not good, I know, but maybe it can be useful as a guide for more commited python coders to properly add proxy support, or for people that have an HTTP proxy and just want the scripts to work.

The scripts I modified:

* YouTube
* google Images
* Ooba
* Live365
* BangBros
* Xelicious
* XboxLyrics
* Comics

What I did: Searched for all build_opener methods and added a urllib2.HTTPProxy({"http","url_proxy"]) line, for scripts using urllib2. Also modified ClientCookie (i know, very bad, but i needed my scripts to be working pronto!). Also installed default urllib._opener to a FancyUrl with proxy.

What I want to do: To know if the Environment Variable thing exists on XBMC's python implementation, so I can install the original versions of the scripts, without having to do bizarre modifications.


Thanx in advance.
Please MSG me if someone interested in my modified scripts.


#2 nuka1195

nuka1195

    X-S Expert

  • Members
  • PipPipPip
  • 639 posts

Posted 09 April 2007 - 01:52 PM

there was/is a patch to allow this (i was suppose to check out) oops, if the patch works an is accepted by the developers (not me) then you'll be set.

If not, at least for the script i've been apart of i can add a setting. (XBMC Lyrics in your list)

#3 nuka1195

nuka1195

    X-S Expert

  • Members
  • PipPipPip
  • 639 posts

Posted 09 April 2007 - 02:15 PM

That patch was accepted, i'll have to see if scripts need to do anything special. It's suppose to be transparent.

It was accepted March 27th, in case your using an older build.

Edited by nuka1195, 09 April 2007 - 02:18 PM.


#4 rodol

rodol

    X-S Enthusiast

  • Members
  • 9 posts
  • Location:Madrid SPAIN
  • Interests:LoWLeVeL
  • Xbox Version:v1.1
  • 360 version:none

Posted 09 April 2007 - 04:11 PM

thanx man!

you talkin about a XBMC patch that will affect all running scripts, or a patch for your (beautiful) XboxLyric script?

If the latter, do you think is there a way to define "environment variables" for the Python Virtual Machine so scripts run unpatched?


Take Care.


#5 nuka1195

nuka1195

    X-S Expert

  • Members
  • PipPipPip
  • 639 posts

Posted 09 April 2007 - 05:59 PM

XBMC Patch.

Shouldn't have to do anything for scripts.

Do you have a build after March 27th, if not can you grab the latest T3CH and test it.

Edited by nuka1195, 09 April 2007 - 06:00 PM.


#6 rodol

rodol

    X-S Enthusiast

  • Members
  • 9 posts
  • Location:Madrid SPAIN
  • Interests:LoWLeVeL
  • Xbox Version:v1.1
  • 360 version:none

Posted 10 April 2007 - 11:01 AM

oh cool! cant wait to upgrade! thanx a lot!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users