I resolved the issue, somehow after installing it to Lib/site-packages of
python installation path , it has not added to PYTHONPATH, because of that
requests is not recognized, i have explicitly added it to the PYTHONPATH
then its working fine.

Thanks,
Amit

On Tue, Aug 21, 2012 at 4:02 PM, Amit <amit.khaw...@gmail.com> wrote:

> Thanks Niphold :), I installed requests libraries using easy install and
> able to see requests folder named "requests-0.13.8-py2.7.egg" in
> site-packages folder and used import statement like :
> from requests import *
>
> but still getting same error :(
>
> what I observed is : there is no module name "requests" in the library but
> there is a folder name "requests" available inside
> "requests-0.13.8-py2.7.egg" folder, so not sure what to import from this
> libray?
>
>
>
>
> On Tue, Aug 21, 2012 at 3:43 PM, Niphlod <niph...@gmail.com> wrote:
>
>> requests is a cool library (don't confuse that with the request object
>> (without the s) that is available in web2py).
>>
>> Their examples lacks of the import line (import requests).
>> Of course you need to install that to be able to use it with pip install
>> requests.
>>
>> Il giorno martedì 21 agosto 2012 12:09:24 UTC+2, Amit ha scritto:
>>>
>>> Hi,
>>> I am using mailgun libraries to send mail from my web2py application,I
>>> followed example given in mailgun site mailgun.com:
>>>
>>>
>>>    1. 
>>> requests.post(("https://api.**mailgun.net/v2/samples.**mailgun.org/messages 
>>> <https://api.mailgun.net/v2/samples.mailgun.org/messages>"),
>>>    2.     auth=("api", "key-**3ax6xnjp29jd6fds4gc373sgvjxteo**l0"),
>>>    3.     data={
>>>    4.             "from": "Excited User <m...@samples.mailgun.org>",
>>>    5.             "to": ["du...@mailgun.net",
>>>    6.                    "de...@mailgun.net"],
>>>    7.             "subject": "Hello",
>>>    8.             "text": "Testing some Mailgun awesomeness!"})
>>>
>>>
>>> but when i am using the above code, web2py gives error "NameError:
>>> global name 'requests' is not defined", what is this requests variable and
>>> how to initialize it?OR do i need to use some other libraries which already
>>> has this variable to make use of it.
>>>
>>> Please guide me to resolve this issue.
>>>
>>>
>>  --
>>
>>
>>
>>
>
>

-- 



Reply via email to