Giter VIP home page Giter VIP logo

Comments (7)

lucaswiman avatar lucaswiman commented on June 17, 2024

According to this stackoverflow thread, all you need to do is specify the files kwarg. IE replace these lines with something like the following:

files = None
if 'file' in data and method == 'POST':
    files = {'file': data.pop('file')}
r = self._method_fn_map.get(method)(url = '%s%s' %(self._api_base_url, url_suffix), 
        data = data, auth = (self._api_key, ''), files=files)

I tried it out and it seems to work, though I'm guessing you'd want somewhat more checking than my naive if statement above.

from lob-python.

coleifer avatar coleifer commented on June 17, 2024

Another workaround I'm using currently is:

def create_object(raw_file_data, **kwargs):
    return lob.Object.make_request(
        method='POST',
        url_suffix=lob.Object._base_url,
        data=kwargs,
        files={'file': raw_file_data})

from lob-python.

soaxelbrooke avatar soaxelbrooke commented on June 17, 2024

Interested in seeing urllib2 port, as it would be usable on Google App Engine. Currently, requests lib isn't supported on GAE.

from lob-python.

leore avatar leore commented on June 17, 2024

Ill add urllib2 instead of requests. Are there any other libs that arent supported on GAE?

from lob-python.

leore avatar leore commented on June 17, 2024

@StuartAxelOwen Where did you see that GAE does not supports requests lib?

from lob-python.

soaxelbrooke avatar soaxelbrooke commented on June 17, 2024

Just tried running it in the GAE development environment. GAE supports relatively few C-based libs: https://developers.google.com/appengine/kb/libraries

from lob-python.

soaxelbrooke avatar soaxelbrooke commented on June 17, 2024

Actually, looks like I'm wrong here: https://github.com/kennethreitz/requests/issues/498

from lob-python.

Related Issues (20)

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.