-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how would you convert a message back to original file? #108
Comments
Please find "my current version" of filewatcher.py file here working with watchdog version 2.2.1 (watchdog==2.2.1) - I will make an update to the documentation, but this should help for the time: `
` |
thank you. i'll try it, so this should automate the send direction. but could you also say something how to convert the received files back or parse them back to the original file by scripting it in a similar filewatcher? at the moment i can only download the files in the web gui but i want to develop some scripts which detects new received messages and convert them back to original files and move them to other folders or post process them for different use cases. for example if a image file was received i want to convert the image to a graycolor image and save it into a specific user folder. all done by raw scripting without gui. |
You need to set a Command on Message Receipt in the partner setting. It can be any command callable from the command line. As per documentation you can simply pass the filename to this command and then it will do whatever your command will do with that file: https://django-pyas2.readthedocs.io/en/latest/detailed-guide/partners.html#advanced-settings a sample would be:
taken from here: #81 |
ok, but i invastigated that for example when i sent an image "test.jpg" with filesize 1000kb then it is received as "test.somerandom.jpg" or "somestring.msg" with a different filesize like 1070kb and also this jpg file can't be opened. there is also a header file and i want to know how can i rebuild the original file? at the moment i don't understand how or in which format the files are saved to the reciever and what have to be done to parse them back or write them back in a binary file like the original. |
Indeed strange. Did you try with django-pyas2 on sender and receiver side? Can you share your settings for this behavior in particular to signature/encryption? Did you try without signature/encryption? |
what i found out now is that setting content type of partner to "binary" the recieved file is exactly the same. so the question is why should i use for example content type "application/edi-consent"? is it secure enough/sufficient to use http:// or is it better to run on https:// or should you proxy pass http:// in production environment (for example with nginx proxy manager)? i also switched to https with this tutorial. should this be the right way? how to put pyas2 into production mode (this warning appears after doing https tutorial)? |
I cannot comment on your first question as of yet, but glad you found a working solution. On production deployment, there are differing views. I use both in production, HTTP as well as HTTPS. Nginx or HAProxy as a reverse proxy applying HTTPS encryption. Then as WSGI server I use gunicorn. The internet is full of deployment guides for Django, depending on infrastructure, host providers etc - here the "official" one. https://docs.djangoproject.com/en/4.2/howto/deployment/ However, the tutorial you are pointing to is django's own development webserver, which you should definitely NOT use in production. |
today i tried the django-pyas2 setup with 2 partners for the first time. all works fine over the web gui. so for testing i sent a image jpg file. in the messgae folder "inbox" and "store" you can then find the image file. but it is not like the original file and the filesize differs from the original file. so how can you convert the message by scripting it (not using the web gui for downloading)?
and is there also a filewatcher with detects new messages to start scripts for auto processing like mentioned here?
https://django-pyas2.readthedocs.io/en/latest/detailed-guide/extending.html
this script gets an error message pointing to:
is there a documentation with more examples how to create automated scripts for building custom post processing tasks with the messages?
The text was updated successfully, but these errors were encountered: