# How to call fscrawler in an app web (python)?

**URL:** <https://discuss.elastic.co/t/how-to-call-fscrawler-in-an-app-web-python/134983>\
**Category:** Elasticsearch\
**Created:** [June 7, 2018, 12:33pm UTC](https://discuss.elastic.co/t/how-to-call-fscrawler-in-an-app-web-python/134983 "2018-06-07T12:33:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![samy\_ouldali](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samy_ouldali/32/32032_2.png) [@samy\_ouldali](https://discuss.elastic.co/u/samy_ouldali)\
**Post date:** [June 7, 2018, 12:33pm UTC](https://discuss.elastic.co/t/how-to-call-fscrawler-in-an-app-web-python/134983/1 "2018-06-07T12:33:47Z")

</div>

Hello everybody, this is my first topic on this forum 🙂

I would like if it was possible to use fscrawler on an app python. In fact, i created a simple interface to communicate with my ES cluster with flask, and it works pretty well.

But i would like create a section to upload new files, at the moment, i still use Kibana console or curl to upload them manually, i would like automatisize this process.

First i was using ingest-attachment plugin, but it does not work with file path, then i just convert manually my file in base64 (with copy-paste) and with PUT it in my index.

Then i discover fscraler, it works with file path; now i want to create a simple button with a function which do exactly same.

Should i create shell script to simply do the command ? Or any idea ? I searched solutions on community forum and i did not find what i wanted, si i ask by myself.

Thanks, and have a good day 🙂

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 7, 2018, 12:50pm UTC](https://discuss.elastic.co/t/how-to-call-fscrawler-in-an-app-web-python/134983/2 "2018-06-07T12:50:29Z")

</div>

That's one of the reasons I added a Rest interface to FSCrawler project so you can just upload a binary file to FSCrawler service.

Then it's "just" a Rest call in python. I'm not a python developer so I can't tell more but that should be easy.

---

<div class="post-metadata">

**Author:** ![samy\_ouldali](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samy_ouldali/32/32032_2.png) [@samy\_ouldali](https://discuss.elastic.co/u/samy_ouldali)\
**Post date:** [June 7, 2018, 12:54pm UTC](https://discuss.elastic.co/t/how-to-call-fscrawler-in-an-app-web-python/134983/3 "2018-06-07T12:54:06Z")

</div>

Hello dadoonet, thanks for answer 🙂 I will check it, thanks a lot

---

<div class="post-metadata">

**Author:** ![samy\_ouldali](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samy_ouldali/32/32032_2.png) [@samy\_ouldali](https://discuss.elastic.co/u/samy_ouldali)\
**Post date:** [June 21, 2018, 12:31pm UTC](https://discuss.elastic.co/t/how-to-call-fscrawler-in-an-app-web-python/134983/4 "2018-06-21T12:31:11Z")

</div>

I solved my problem by the way, i will say here what happened, maybe it will help someone

In my app, i had to get my file with javascript and a simple function:

```
function MyFunction(){
var myFile = document.getElementById('fileInput').files[0];

}

```

with fileInput the id of upload form:

`<input type="file" name="fileInput" id="fileInput" onchange="myFunction()" >`

then there is the python part:

first of all i had to get my file object:

`f = request.files['fileInput']`

but it is fileObject so we have to "reflow" it:

> sendFile = {"file": (f.filename, f.stream, f.mimetype)}

If we don't, we could not post it.

Finally i use a function from requests library:

`r = requests.post(url, files=sendFile)`

I hope it will help some people 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 19, 2018, 12:31pm UTC](https://discuss.elastic.co/t/how-to-call-fscrawler-in-an-app-web-python/134983/5 "2018-07-19T12:31:11Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
