Re: Testing posts to S3

2015-02-11 Thread Tom Evans
On Wed, Feb 11, 2015 at 7:36 PM, Lee Hinde  wrote:
> I'm using django storages/boto to push json files to s3 where they are to be
> read by a different app.
>
> I'd like to test the file push by using the Test Client to see if the file
> is present on S3.
>
> client = Client()
> r = client.get(url, content_type="application/json")
>
> In every case, r comes back as:
>
> 
>
> I can take the  'url' and paste it into my browser and get the file.
>
> So, there's something about the process I'm not understanding. Is this not
> what Client is intended for?

No, the test client isn't a client for making web requests, it is a
client that creates phony request objects and simulates the
request/response inside of django itself. No network activity will
take place!

Just open it:

try:
r = urllib.urlopen(url).read()
except IOError:
...

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1%2BZPVagLTGP9t%3Dpk%2B%3Di7%2BssSu%3DL5T9UO2Y8kEhPwVUkgA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Testing posts to S3

2015-02-11 Thread Lee Hinde
I'm using django storages/boto to push json files to s3 where they are to
be read by a different app.

I'd like to test the file push by using the Test Client to see if the file
is present on S3.

client = Client()
r = client.get(url, content_type="application/json")

In every case, r comes back as:



I can take the  'url' and paste it into my browser and get the file.

So, there's something about the process I'm not understanding. Is this not
what Client is intended for?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMw-gi%2BMMKXRAVA6XbpSXGmCP38rc2c-c2%3DJQ%3D6bOcPc3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.