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";),
>    2.     auth=("api", "key-3ax6xnjp29jd6fds4gc373sgvjxteol0"),
>    3.     data={
>    4.             "from": "Excited User <m...@samples.mailgun.org 
> <javascript:>>",
>    5.             "to": ["du...@mailgun.net <javascript:>",
>    6.                    "de...@mailgun.net <javascript:>"],
>    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