Re: [Twisted-Python] Proxy support through urllib2?

2010-01-19 Thread Gabriel Rossetti
exar...@twistedmatrix.com wrote:
> On 01:33 pm, gabriel.rosse...@arimaz.com wrote:
>   
>> Hello everyone,
>>
>> Is it possible to use a proxy with Twisted? I can do this with urllib2 
>> :
>>
>> proxy = urllib2.ProxyHandler({"http": "http://my.proxy.com:8080"})
>> opener = urllib2.build_opener(proxy)
>> urllib2.install_opener(opener)
>>
>> will that suffice? I'd need SOCKSv5 and HTTP proxy support.
>> 
>
> This is one of the features the new HTTP client is intended to make 
> easier to implement.  The very short twisted.web.client.Agent is 
> responsible for all the things which differ when connecting to a proxy 
> instead of doing the usual thing.  At some point, twisted.web.client 
> should offer something like Agent which provides the proxy 
> functionality.  Do you want to take a stab at implementing it?
>
> Jean-Paul
>   
Ok, thanks for the info. I can have a try, right now we use Twisted 
8.1.0 though, I have to get something working with that version first 
and then whe we've tested our app with version 9.0 I'll try.

Gabriel



___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Proxy support through urllib2?

2010-01-19 Thread Gabriel Rossetti
Kevin Horn wrote:
> On Mon, Jan 11, 2010 at 7:33 AM, Gabriel Rossetti 
> mailto:gabriel.rosse...@arimaz.com>> wrote:
>
> Hello everyone,
>
> Is it possible to use a proxy with Twisted? I can do this with
> urllib2 :
>
> proxy = urllib2.ProxyHandler({"http": "http://my.proxy.com:8080"})
> opener = urllib2.build_opener(proxy)
> urllib2.install_opener(opener)
>
> will that suffice? I'd need SOCKSv5 and HTTP proxy support.
>
> Thanks,
> Gabriel
>
>
> When you say you want to "use a proxy with Twisted", do you mean that 
> you want Your Twisted applicatino to provide a proxy to other 
> applications, or do you mean that you want your Twisted application to 
> use a (separate) proxy?
>
> Kevin Horn
>   
I mean have the Twisted app (client) connect to a server outside the 
network by going through an http proxy server, like it's often the caser 
in company networks.

Gabriel

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] deferring result to PB a callRemote method

2010-01-19 Thread Kevin Horn
On Mon, Jan 18, 2010 at 7:19 PM, Andrew Bennetts wrote:

> >Google is my friend but I could not find examples of this usage. Is
> there
> >any references to this usage in the twisted docs?
>
>
> Huh, surprisingly not in the primary PB docs.  The Twisted “finger”
> tutorial
> does do this, though, if you read it carefully enough.  See finger21.tac in
> ;
> the
> remote_* methods of PerspectiveFingerFromService delegate to self.service,
> which
> is FingerService, which returns Deferreds from its getUser and getUsers
> methods.
>
>
>
It sems like this should be discussed in the PB docs.  Maybe someone should
file a ticket..

(hint, hint)

Kevin Horn
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] [ANN] Foolscap-0.5.0 released

2010-01-19 Thread Brian Warner

I'm pleased to announce the release of Foolscap-0.5.0 . This is a fairly
minor release: the biggest difference from the previous 0.4.2 is a
change to the preferred main entry point: application code should use
e.g. "from foolscap.api import Tub" instead of "from foolscap import
Tub". A DeprecationWarning will be raised for code that continues to
import from the main "foolscap" module, which will become an error in a
future foolscap-0.6.0. (this was done to avoid annoying circular
dependencies within foolscap itself)

In addition, many tools received minor improvements, and the "sets is
deprecated in python2.6" warning was fixed.

 Bugs, docs, discussion: http://foolscap.lothar.com/trac
 Download:
  PyPI: http://pypi.python.org/pypi/foolscap/0.5.0
  home page: http://foolscap.lothar.com/releases/foolscap-0.5.0.tar.gz
  Releases are signed with my GPG key 0x1514A7BD, recently renewed
  (expiration date extended to jan-2011, please re-download from
  keyservers)

Foolscap is a Twisted-friendly remote object protocol, a descendant of
Perspective Broker, with improved security properties, third-party
references, adaptable serialization, remote logging, and other useful
features. Please visit http://foolscap.lothar.com/trac for more details.


have a importable day,
 -Brian




* Release 0.5.0 (18 Jan 2010)

** Compatibility

The wire format remains the same as in earlier releases. The preferred
API import path has changed, see below.

** API changes: import statements, foolscap.api

To reduce circular dependencies in Foolscap's internal code, a new
"foolscap.api" module has been created. Applications should use:

 from foolscap.api import Tub

instead of e.g. "from foolscap import Tub". Deprecation warnings will be
raised for code which imports symbols directly from the "foolscap"
module. These warnings will turn into errors in the 0.6.0 release. (see
ticket #122 for details)

The nearly-useless getRemoteURL_TCP() function was removed.

** setup.py is more windows-friendly

The main setup.py script has been modified to use setuptools
"entry_points=" on windows, which should help create runnable
executables of "flogtool" and "flappserver", with proper extensions.
Entry-point scripts are not used on non-windows platforms, but
setuptools still creates fairly opaque executable scripts (which makes
it hard to figure out that e.g. /usr/bin/flogtool wants to import the
"foolscap" module). To get non-opaque scripts, install with "setup.py
install --single-version-externally-managed". (#109)

** tool changes

*** flappserver

"flappserver create" now records the umask value from its environment,
and uses it later when the server is started (since normally twistd
resets the umask to a very restrictive value). A new --umask argument
was added to override this. The server's base directory is chmod go-rwx
to protect the private key from other users.

The "flappserver start" command uses twisted.scripts.twistd.run(),
instead of spawning an intermediate "twistd" process with os.execvp().
This should make things work better in environments where Twisted is not
fully installed (especially on windows) and correctly launching "twistd"
is non-trivial, such as when some other package is installing it as a
setuptools dependency.

"flappclient upload-file ~/foo.txt" will use os.path.expanduser() on the
filename, even if your shell does not. This should make it easier to use
from e.g. buildbot upload commands. (#134)

*** logging

The "flogtool dump" and "flogtool web-viewer" commands now have a
--timestamps argument, which controls how timestamps are expressed (UTC
vs localtime, ISO-9601, etc). The web-viewer HTML pages now have more
timestamp and sorting options, and hyperlinks to select each. (#100)

"flogtool web-viewer --open" will tell your local web browser to open to
the correct page, using the Python stdlib "webbrowser" module.

"flogtool dump" now emits a better error when told to open a missing
file.

*** examples

Examples of running the Git version-control-system over a
flappserver-based secure connection have been added to doc/examples/ .
This enables remote-update authority to be expressed as a FURL with no
other shell privileges. To accomplish the same with ssh
"authorized_keys" command restrictions is annoying and error-prone. See
doc/examples/git-proxy-flappclient for setup instructions. This will
probably be simplified to a single "git-furl" executable in a later
release.

The xfer-client/xfer-server/command-client examples have been removed,
obsoleted by the flappserver/flappclient tools.

** Other changes

The DeprecationWarning for the obsolete "sets" module is now removed on
python2.6 (#124)

When a getReference() call fails because the remote Tub does not
recognize the FURL, it now only emits the first two letters of the
secret swissnum in the exception, instead of the whole thing. This
reduces information leakage into e.g. stderr logs from a "flappclient
--furlfile=X upload-file" command.

DeadReferenceError 

[Twisted-Python] Lore to Sphinx Conversion Progress Report 4

2010-01-19 Thread Kevin Horn
This time I think I'm gonna skip saying how I haven't gotten as much done as
I would like...oh darn.

Anyways, time for another gripping installment...

Progress:
  - tables are now handled (mostly) properly, thanks to Zeth at
http://commandline.org.uk/
  - blockquote tags handled
  - much improved whitespace/indentation handling
  - some nicer styling thanks to Michael Thompson
  - I've managed to convert the docs for the 3 Divmod projects with Lore
docs, though I've yet to put them up anywhere.


Oustanding issues:
  - two files in the Lore source are not yet being converted, but it looks
like
one of them is about to be removed
(http://twistedmatrix.com/trac/ticket/4188), and it's not really a
Lore doc anyways.
  - due to ReST's insistence on "inline markup" being surrounded by
whitespace or certain special characters, there are a lot of places
where
such inline markup gets jacked up, by not including whitespace in front
of
it.  If I put whitespace in front of everything though, my indentation
handling gets jacked up and about 400+ Sphinx build warning result.
Not sure if I should spend the time to make whitespace handling really
smart or if these should just be fixed manually post-conversion.
  - cite tags still need handling...not hard, just haven't decided the best
way to do it yet.
  - Themeing/styling: still mostly a TODO, though new styling looks a lot
better than the default to my eyes.  I'm starting to think that
eventually we might want to have 2 themes/styles...one to match the
trac-based website, and one for bundled docs (docs tarballs, CHM files,
etc.)
  - auto-generated toctree directives are currently generated in
alphabetical
order, which makes the "prev" and "next" links mostly make no sense
  - some of the Lore source files have nested "inline markup", which ReST
disallows.  This can be handled by:
  - fix the markup in the Lore source
  - figure out some kind of supersmart auto-conversion for every
possible
combination of nesting
  - just handle the outside level of nesting (what I'm doing now) and
fix any problems manually post-conversion.
  - xhtml entities are not currently resolved...mostly because it makes
the build take a LNG time.  They can be though.  This shouldn't
be a problem.
  - xhtml comments still need to be handled
  -  tags need something better..right now they are just
the same as  tags...Sphinx has an upcoming feature coming in 1.0
that would make this nice and maintainable in the long run, but I don't
know that I want to wait for it.  I may try to "backport" the extension
or just come up with a separate solution.
  - some of the generated links need fixing
(e.g. links to directories, .py files)

In other news:

  - Foolscap 0.5 was released today, which made me wonder what they use for
docs...and it's Lore.  I brought this up on IRC, and it was suggested
by many that Lore should stick around even after the conversion
according
to the standard Twisted compatibility policy, to give anyone who still
uses it time to migrate.  This sounds like a fine idea to me.
Any thoughts?


As always, the lore2sphinx code is here:
http://bitbucket.org/khorn/lore2sphinx/

And the sample output of the conversion process is here:
http://twistedsphinx.funsize.net/

Cheers,

Kevin Horn
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] deferring result to PB a callRemote method

2010-01-19 Thread Chris Laws
> >* >Google is my friend but I could not find examples of this usage.
Is
*> >* there
*> >* >any references to this usage in the twisted docs?
*> >*
*> >*
*> >* Huh, surprisingly not in the primary PB docs.  The Twisted “finger”
*> >* tutorial
*> >* does do this, though, if you read it carefully enough.  See
finger21.tac in
*> >* <
http://twistedmatrix.com/documents/current/core/howto/tutorial/pb.html>;
*> >* the
*> >* remote_* methods of PerspectiveFingerFromService delegate to
self.service,
*> >* which
*> >* is FingerService, which returns Deferreds from its getUser and
getUsers
*> >* methods.
*> >*
*> >*
*> >*
*> It sems like this should be discussed in the PB docs.  Maybe someone
should
> file a ticket..
>
> (hint, hint)

Done, #4228.

Thanks for the informative response to my question.

Regards,
Chris
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python