Code Monkey home page Code Monkey logo

python-rest-client's People

Watchers

 avatar

python-rest-client's Issues

request method ignores User-Agent header

Connection.request() overwrites any value for User-Agent supplied in a dict
value for the headers parameter with 'Basic Agent'. It should instead test
for the presence of a value for key 'User-Agent' before writing a default
value.


Original issue reported on code.google.com by [email protected] on 29 Jun 2009 at 9:22

Default empty headers aren't safely defined in request_*()

Comme python mistake.
It causes a real problem here when the function is called several times 
with headers uninitialized : added headers are kept in next call. Sorry to 
be short on details.

There is a quick fix, but this could be fixed better.

===================================================================
--- restful_lib.py  (revision 12)
+++ restful_lib.py  (working copy)
@@ -79,6 +79,7 @@
         return guessed_mimetype or 'application/octet-stream'

     def request(self, resource, method = "get", args = None, body = None, 
filename=None, headers={}):
+   headers = headers or {} ## prevents old headers to be carried along 
with further requests
         params = None
         path = resource
         headers['User-Agent'] = 'Basic Agent'

Original issue reported on code.google.com by [email protected] on 8 Mar 2010 at 11:32

Import Error: No module with restful_lib

What steps will reproduce the problem?
1. Create a script with restful_lib and have a rest api call
2. Started running in the command prompt getting the error message.3. 

What is the expected output? What do you see instead?
Should make the rest call.

I see the error message
ImportError: No module named restful_lib,
I searched in net i could not get any specific information.

What version of the product are you using? On what operating system?
Python 3.4.0

Please specify this is urgent for me


Original issue reported on code.google.com by [email protected] on 28 Mar 2014 at 11:09

adding a trailing / into uri at the end in line 140

line 140 of restful_lib.py 

u"%s://%s%s" % (self.scheme, self.host, u'/'.join(request_path)

this will add a trailing '/' into the end of uri, even though if I specifically 
make a uri that does not 
have a '/' (i.e request is http://locahost/resource becomes 
http://localhost/resource/). This pose a 
significant problem if the server does validate uri patterns for resource. 

I'm not an expert on REST, but can you please provide explanation for adding 
that '/' ? 

Thanks, 

Original issue reported on code.google.com by [email protected] on 5 Mar 2010 at 2:58

Packaging request

Any chance of packaging this release as a distutils and/or setuptools package?

Original issue reported on code.google.com by [email protected] on 12 Oct 2009 at 10:33

User-Agent header is hardcoded

It should be possible to override the User-Agent header.

Something along the following should do it


    if not headers.get('User-Agent', None):
        headers['User-Agent'] = 'Basic Agent'


Original issue reported on code.google.com by [email protected] on 11 Oct 2009 at 8:05

twitter.py and twitter.py from python-twitter use the same name/location

What steps will reproduce the problem?
1. file twitter.py and file twitter.py from python-twitter both will be 
installed in /usr/lib/python/site-packages.

This is bad for inclusion in linux distros and may leed to unwanted effects 
when installing python-twitter not via package manager.

Is it possible to move all files in a module e.g. into 
/usr/lib/pythin/site-packages/rest_client ?




Original issue reported on code.google.com by [email protected] on 27 Jan 2012 at 7:42

".cache" file.

I'm using restful_lib with apache, which normally doesn't have write 
permission to the code, so it is very annoying to have to manually create 
this file and give apache permission to write to it every time I set up the 
module.

Would it be possible to be able to change the location of this file?

Original issue reported on code.google.com by [email protected] on 3 Jun 2010 at 9:31

__init__.py missing

Thus cannot install as site package and import.

the following line in the file should be enough:

from restful_lib import *


Original issue reported on code.google.com by [email protected] on 10 Oct 2009 at 3:56

simple HTTPS request fails with TypeError: a float is required under Python 2.6

What steps will reproduce the problem?
>>> from restful_lib import Connection
>>> conn = Connection('https://www.google.com')
>>> conn.request_get('foo')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "restful_lib.py", line 62, in request_get
    return self.request(resource, "get", args, headers=headers)
  File "restful_lib.py", line 140, in request
    resp, content = self.h.request(u"%s://%s%s" % (self.scheme, self.host,
u'/'.join(request_path)), method.upper(), body=body, headers=headers )
  File "httplib2\__init__.py", line 1051, in request
    (response, content) = self._request(conn, authority, uri, request_uri,
method, body, headers, redirections, cachekey)
  File "httplib2\__init__.py", line 855, in _request
    (response, content) = self._conn_request(conn, request_uri, method,
body, headers)
  File "httplib2\__init__.py", line 824, in _conn_request
    conn.request(method, request_uri, body, headers)
  File "C:\python\lib\httplib.py", line 874, in request
    self._send_request(method, url, body, headers)
  File "C:\python\lib\httplib.py", line 911, in _send_request
    self.endheaders()
  File "C:\python\lib\httplib.py", line 868, in endheaders
    self._send_output()
  File "C:\python\lib\httplib.py", line 740, in _send_output
    self.send(msg)
  File "C:\python\lib\httplib.py", line 699, in send
    self.connect()
  File "httplib2\__init__.py", line 737, in connect
    sock.settimeout(self.timeout)
  File "<string>", line 1, in settimeout
TypeError: a float is required

This is a checkout of the latest SVN trunk running on Windows Vista 64-bit
Python 2.6 64-bit.

This problem doesn't seem to happen with an HTTP request because the order
in which the httplib2.HTTPConnectionWithTimout.timeout member is set.

Original issue reported on code.google.com by jaraco%[email protected] on 26 May 2009 at 6:24

Usability issue with failing TCP connections

What steps will reproduce the problem?
1. Assuming nothing listening on 127.0.0.1 port 80 ...
2. Run the following sample code ...

>>> from restful_lib import Connection
>>> c = Connection('http://localhost')
>>> print c.request('/api/foo/', method='GET')

What is the expected output?

Some kind of error message/exception stating 'connection refused' or
'connection failed'.

What do you see instead?

The rather cryptic AttributeError (with traceback) :-

Traceback (most recent call last):
  File "/tmp/test2.py", line 4, in <module>
    print c.request('/api/foo/', method='GET')
  File "/tmp/restful_lib.py", line 127, in request
    resp, content = self.h.request(u"%s://%s%s" % (self.scheme, self.host,
u'/'.join(request_path)), method.upper(), body=body, headers=headers )
  File "/usr/lib/python2.5/site-packages/httplib2/__init__.py", line 1101,
in request
    (response, content) = self._request(conn, authority, uri, request_uri,
method, body, headers, redirections, cachekey)
  File "/usr/lib/python2.5/site-packages/httplib2/__init__.py", line 887,
in _request
    (response, content) = self._conn_request(conn, request_uri, method,
body, headers)
  File "/usr/lib/python2.5/site-packages/httplib2/__init__.py", line 859,
in _conn_request
    response = conn.getresponse()
  File "/usr/lib/python2.5/httplib.py", line 926, in getresponse
    method=self._method)
  File "/usr/lib/python2.5/httplib.py", line 324, in __init__
    self.fp = sock.makefile('rb', 0)
AttributeError: 'NoneType' object has no attribute 'makefile'

What version of the product are you using?

Release 0.2

Any other information?

This does not occur when an HTTP server is up and listening for connections
;-) Not sure if this is a problem with underlying httplib2 library or the
way in which it is being called.

Original issue reported on code.google.com by [email protected] on 12 Oct 2009 at 10:30

Development moved to http://code.google.com/p/python-rest-client2/

What steps will reproduce the problem?
1. Unmaintained project
2. Only creator has access to project
3. Patches submitted by users

What is the expected output? What do you see instead?
Maintained Project

What version of the product are you using? On what operating system?


Please provide any additional information below.
Please go to http://code.google.com/p/python-rest-client2/ for patched version 
of this project

Original issue reported on code.google.com by [email protected] on 3 Oct 2010 at 7:13

Problem with file uploading

It is not possible to upload files along with other parameters.

I did a simple hack to get it working. I omitted some style issues (like
having the parameter filename keep its name even though it actually
receives a file object now) because I don't know how those things are
supposed to interact with the rest of the code. 

I am sorry I'm sending the whole file instead of a patch but I'm not
tracking the repo.

I hope this helps,
Cheers

Nicolas


Original issue reported on code.google.com by [email protected] on 10 Sep 2009 at 5:26

Attachments:

Patch for POST body

I made the following changes
 1. Added ability to POST body
 2. Added test case
 3. I change keywords in some functions to **kwards ( I don't think I needed to do that, but I did)



Original issue reported on code.google.com by [email protected] on 6 Oct 2009 at 8:44

Attachments:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.