Giter Site home page Giter Site logo

fuzee's People

Contributors

ammaraziz avatar

Watchers

 avatar

fuzee's Issues

Add support for downloading reports

Provide functionality to download pdf reports sent via automated email.

Burger menu > History > Search Emails

Two step process, first send a POST to get a list emails per report followed by a GET request to download a specific report.

POST request

https://my.fuzee.com/ajax
cookies = FUZEESTAYLOGGEDIN=YES; FUZEEUSERAUTH=MXwxNjYxOTIxMTAxfG9IdjhwV29sZmdPbkMxa1Q%3D
request body = c=table&s=emailHistory&from=X&to=Y&type=

X/Y = date in YYYY-MM-DD format

POST Response:

A json with two fields.

  1. types contains a list of table names and their ID.
Object { table: "TABLEID", "ucase(left(`table`,1))": "Q", name: "Storage Listing" }

TABLEIDs need to be stored in a named list to access by name.

  1. data, which contains a list objects
type:  "Email"
id: "UNIQID"
table: "Report Name"
field: ""
data: "CentreName"
created: "25/08/2022 16:34"
user: "Person Name"
sort: "2022-08-25 16:34:16"
uid: ""
to: "email"

id is needed as the unique identifier to download the email.

GET request to download

https://my.fuzee.com/ajax?c=file&s=get&file_code=UNIQID

File is downloaded as an eml, which is plain text mime file. File needs to be read line by line until the attachment.

Attachment head:

--b1_946c9f3e62087e2f21e9b761e448c41851da4fefa86a7aa0c1d6fc8435c652ad
Content-Type: application/pdf; name="NAME"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="NAME"

< pdf encoded as base64 >

--b1_946c9f3e62087e2f21e9b761e448c41851da4fefa86a7aa0c1d6fc8435c652ad

R code to convert to pdf:

txt = readLines("test.txt")
a = base64enc::base64decode(txt)
writeBin(a, "test.pdf")

txt looks like this:

[1] "JVBERi0xLjMKMyAwIG9iago8PC9UeXBlIC9QYWdlCi9QYXJlbnQgMSAwIFIKL1Jlc291cmNlcyAy"
[2] "IDAgUgovQ29udGVudHMgNCAwIFI+PgplbmRvYmoKNCAwIG9iago8PC9GaWx0ZXIgL0ZsYXRlRGVj"
[3] "b2RlIC9MZW5ndGggMjQzMT4+CnN0cmVhbQp4nM2bT3PbthbF9/kUWLbTBCbA/7u6cdu4k0nznj3t"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.