# Nameko use question

**URL:** <https://discourse.nameko.io/t/nameko-use-question/442>\
**Category:** Uncategorized\
**Created:** [June 3, 2019, 6:04am UTC](https://discourse.nameko.io/t/nameko-use-question/442 "2019-06-03T06:04:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xolosno](https://avatars.discourse-cdn.com/v4/letter/x/7feea3/32.png) [@xolosno](https://discourse.nameko.io/u/xolosno)\
**Post date:** [June 3, 2019, 6:04am UTC](https://discourse.nameko.io/t/nameko-use-question/442/1 "2019-06-03T06:04:36Z")

</div>

if I want to use nameko http package do I need to install rabbitmq also? for example, does running the service below requires rabbitmq installed?

import urllib  
from nameko.web.handlers import http  
from urllib.request import urlopen  
import json

class HttpService:  
name = “getFileContents”

```
@http('GET', '/get/<int:value>')
def get_method(self, request, value):
    return json.dumps({'value': value})
```

---

<div class="post-metadata">

**Author:** ![Jakub\_Borys](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/jakub_borys/32/7_2.png) [@Jakub\_Borys](https://discourse.nameko.io/u/Jakub_Borys)\
**Post date:** [June 3, 2019, 8:15am UTC](https://discourse.nameko.io/t/nameko-use-question/442/2 "2019-06-03T08:15:33Z")

</div>

If you do not import `rpc` extension (`from nameko.rpc import rpc`) RabbitMQ will not be required.

---

<div class="post-metadata">

**Author:** ![xolosno](https://avatars.discourse-cdn.com/v4/letter/x/7feea3/32.png) [@xolosno](https://discourse.nameko.io/u/xolosno)\
**Post date:** [June 3, 2019, 6:20pm UTC](https://discourse.nameko.io/t/nameko-use-question/442/3 "2019-06-03T18:20:13Z")

</div>

Thank you! It is not clear from documentation if http package requires rabbitmq. And also there is so little of documentation and examples of how to start with nameko.

---

<div class="post-metadata">

**Author:** ![Jakub\_Borys](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/jakub_borys/32/7_2.png) [@Jakub\_Borys](https://discourse.nameko.io/u/Jakub_Borys)\
**Post date:** [June 3, 2019, 7:09pm UTC](https://discourse.nameko.io/t/nameko-use-question/442/4 "2019-06-03T19:09:28Z")

</div>

Are there particular things which seemed hard/confusing in the beginning?

Main documentation site is here [https://docs.nameko.io](https://docs.nameko.io/). We’re also maintaining full end-to-end examples repository here [https://github.com/nameko/nameko-examples](https://github.com/nameko/nameko-examples)

PRs to improve documentation are always welcome!

---

<div class="post-metadata">

**Author:** ![xolosno](https://avatars.discourse-cdn.com/v4/letter/x/7feea3/32.png) [@xolosno](https://discourse.nameko.io/u/xolosno)\
**Post date:** [June 3, 2019, 7:50pm UTC](https://discourse.nameko.io/t/nameko-use-question/442/5 "2019-06-03T19:50:31Z")

</div>

Thank you very much for links and for your reply. I have an issue to understand how to code the file download using nameko service. I found this example for upload file:

@http(“GET”, “/”)  
def upload\_file(self, request):  
files = {“my\_file”: open(“hello.txt”, “rb”)}  
response = requests.post(self.server\_url, files=files)  
return response.text

I cant figure out how to download file. I know that it is somewhere is documentation but I cant seem to find this.

I will use curl from my client as curl [http://localhost](http://localhost):port/command/file.txt -O and it should trigger the nameko service on front end vm and then get to the service on backend vm which will pass the file content to frontend and then to the client.

The code on frontend:

@http(‘GET’, ‘/grab/\<string:cmd\>/’)  
def get\_method(self, request, cmd):  
#ip = config.get(‘IP’)  
ip = ‘10.1.1.17’  
cip = “http://”+ip +":8000" +"/" + cmd  
print(“IP: " + cip)  
print(”\n")  
with urllib.request.urlopen(cip) as response:  
html = response.read()  
html = html.decode(“utf8”)  
response.close()  
return html

The code in backend:

import os  
import urllib  
from nameko.web.handlers import http  
from urllib.request import urlopen  
import sys

class HttpService:  
name = “download\_file”

```
# Print commands
@http('GET', '/')
def get_method1(self, request):
    cmds = '''
                COMMANDS: 
                get_file          
                '''
    sys.stdout.flush()
    return cmds

@http('GET', '/getFileContents/\<string:filename\>')
def get_file(self, request, filename):
    with open('/vagrant/src/files+filename , 'r') as f:
        result = f.read().replace('\n', '')
    return result

```

However, I have an issue to pass file name as a parameter with curl. Any advice is appreciated.  
Thank you.
