kandi background
Explore Kits

informer | A Telegram Mass Surveillance Bot in Python | Bot library

 by   paulpierre Python Version: Current License: MIT

 by   paulpierre Python Version: Current License: MIT

Download this library from

kandi X-RAY | informer Summary

informer is a Python library typically used in Automation, Bot, Docker applications. informer has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. However informer build file is not available. You can download it from GitHub.
Informer (TGInformer) is a bot library that allows you to masquerade as multiple REAL users on telegram and spy on 500+ Telegram channels per account. Details are logged to a MySQL database, a private Google Sheet and your own private channel for analysis. This is a functioning proof-of-concept project with known bugs. Feel free to fork, share and drop me a line.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • informer has a medium active ecosystem.
  • It has 853 star(s) with 152 fork(s). There are 29 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 0 open issues and 5 have been closed. On average issues are closed in 75 days. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of informer is current.
informer Support
Best in #Bot
Average in #Bot
informer Support
Best in #Bot
Average in #Bot

quality kandi Quality

  • informer has 0 bugs and 0 code smells.
informer Quality
Best in #Bot
Average in #Bot
informer Quality
Best in #Bot
Average in #Bot

securitySecurity

  • informer has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • informer code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
informer Security
Best in #Bot
Average in #Bot
informer Security
Best in #Bot
Average in #Bot

license License

  • informer is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
informer License
Best in #Bot
Average in #Bot
informer License
Best in #Bot
Average in #Bot

buildReuse

  • informer releases are not available. You will need to build from source code and install.
  • informer has no build file. You will be need to create the build yourself to build the component from source.
  • Installation instructions, examples and code snippets are available.
  • informer saves you 309 person hours of effort in developing the same functionality from scratch.
  • It has 743 lines of code, 21 functions and 4 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
informer Reuse
Best in #Bot
Average in #Bot
informer Reuse
Best in #Bot
Average in #Bot
Top functions reviewed by kandi - BETA

kandi has reviewed informer and discovered the below as its top functions. This is intended to give you an instant insight into informer implemented functionality, and help decide if they suit your requirements.

  • Initialize the channel data .
  • Send a notification .
  • Initialize notifications .
  • Initialize the engine .
  • Initialize the database .
  • Initialize bot account .
  • Add monitors to the database .
  • Initialize the database .
  • Initialize data .

informer Key Features

Run all your bots in the cloud while you sleep. Support for Docker Compose

Write all notifications to private Google Sheet

Supports regular expressions for keyword filtering

SQLAlchemy for agnostic data persistence

Logging contextual message and channel data to a private channel and database

Stores meta information about sender of message, channel, number of participants in the channel

Auto-joins channels from CSV list containing Telegram channel URLs

Persists session of channels joined

Login once, bot stays logged in forever without needing 2FA re-authentication

Join up to 500 channels per account

Uses REAL accounts avoiding bot detection, THIS IS NOT A TELEGRAM BOT but a real automated user account. This is an important distinction because the official bot API is limited and bots are often restricted in public channels.

Telethon SDK

copy iconCopydownload iconDownload
This file happens to be a sqlite database which you can connect to. It 	
acts like a cache and stores historical data as well as your session 
authentication information so you will not have to re-authenticate with 
Telegram’s 2FA . Note that you will need to login for a first time and 
authenticate when you first use the API.

Stuck with xml download using python. How to handle that?

copy iconCopydownload iconDownload
import requests 
import base64

url = 'http://fnet.bmfbovespa.com.br/fnet/publico/downloadDocumento?id=247031' 
response = requests.get(url,verify=False, headers={'User-Agent':'Mozzila/5.0'}) 
decoded = base64.b64decode(response.content)
print(decoded)

Exception: The parameters (String,String,String,(class),(class)) don't match the method signature for GmailApp.sendEmail

copy iconCopydownload iconDownload
GmailApp.sendEmail(emailAddress,emailSubject,corps,{htmlBody:htmlForEmail, attachments:[blob]});

SharedInformerFactoryWithOptions - Not able to filter based on labels

copy iconCopydownload iconDownload
labelOptions := informers.WithTweakListOptions(func(opts *metav1.ListOptions) {
    opts.LabelSelector = "app=nats-box"
})
factory := informers.NewSharedInformerFactoryWithOptions(clientset, 0, informers.WithNamespace("default") ,labelOptions)
informer := factory.Core().V1().Pods().Informer()
stopper := make(chan struct{})
defer close(stopper)
informer.AddEventHandler(cache.ResourceEventHandlerFuncs{
    AddFunc: func(obj interface{}) {
        fmt.Println("pod add")
        name := obj.(*corev1.Pod).Name
        labels := obj.(*corev1.Pod).Labels
        fmt.Printf("pod Name: %s\nLabels - %v\n\n", name, labels)
    },
})
informer.Run(stopper)

Save correctly in PDF to Drive a Google Sheet

copy iconCopydownload iconDownload
  // var destSheet = destSpreadsheet.getSheets()[0];
  // var sourceRange = sourceSheet.getRange(1,1,sourceSheet.getMaxRows(),sourceSheet.getMaxColumns());
  // var sourcevalues = sourceRange.getValues();
  // var destRange = destSheet.getRange(1, 1, destSheet.getMaxRows(), destSheet.getMaxColumns());
  // destRange.setValues(sourcevalues);
var range = destSpreadsheet.getSheetByName('SYNTHESE').getDataRange(); 
range.setValues(range.getDisplayValues());
function sauvegardeDrive() {
  // Déclaration des variables et constantes
  const classeur = SpreadsheetApp.getActiveSpreadsheet();
  const feuille = classeur.getSheetByName('SYNTHESE');
  var sheetName = "SYNTHESE";
  var folderID = "1gZEWeG4XzZDuEqDDWKaMoVolMmeLWDRI";
  var sourceSpreadsheet = SpreadsheetApp.getActive();
  var sourceSheet = sourceSpreadsheet.getSheetByName(sheetName);
  var folder = DriveApp.getFolderById(folderID);
  var semaine = feuille.getRange('B5').getValue();
  var annee = feuille.getRange('B4').getValue();
  var pdfName = "test"+semaine+"_"+annee+".pdf";

  // Pièce jointe -- this part is stealed from envoiMail() function
  var url = "https://docs.google.com/spreadsheets/d/SS_ID/export?".replace("SS_ID", classeur.getId());
  var url_ext = 'exportFormat=pdf&format=pdf' + '&size=A4' + '&portrait=true' + '&fitw=true&source=labnol' 
              + '&sheetnames=false&printtitle=false' + '&pagenumbers=false&gridlines=false' + '&fzr=false' + '&gid=';
  var token = ScriptApp.getOAuthToken();
  var pdfMarge = UrlFetchApp.fetch(url + url_ext + feuille.getSheetId(),{headers : {
                'Authorization' : 'Bearer ' + token }}).getBlob().setName(pdfName);

  folder.createFile(pdfMarge);
}
-----------------------
  // var destSheet = destSpreadsheet.getSheets()[0];
  // var sourceRange = sourceSheet.getRange(1,1,sourceSheet.getMaxRows(),sourceSheet.getMaxColumns());
  // var sourcevalues = sourceRange.getValues();
  // var destRange = destSheet.getRange(1, 1, destSheet.getMaxRows(), destSheet.getMaxColumns());
  // destRange.setValues(sourcevalues);
var range = destSpreadsheet.getSheetByName('SYNTHESE').getDataRange(); 
range.setValues(range.getDisplayValues());
function sauvegardeDrive() {
  // Déclaration des variables et constantes
  const classeur = SpreadsheetApp.getActiveSpreadsheet();
  const feuille = classeur.getSheetByName('SYNTHESE');
  var sheetName = "SYNTHESE";
  var folderID = "1gZEWeG4XzZDuEqDDWKaMoVolMmeLWDRI";
  var sourceSpreadsheet = SpreadsheetApp.getActive();
  var sourceSheet = sourceSpreadsheet.getSheetByName(sheetName);
  var folder = DriveApp.getFolderById(folderID);
  var semaine = feuille.getRange('B5').getValue();
  var annee = feuille.getRange('B4').getValue();
  var pdfName = "test"+semaine+"_"+annee+".pdf";

  // Pièce jointe -- this part is stealed from envoiMail() function
  var url = "https://docs.google.com/spreadsheets/d/SS_ID/export?".replace("SS_ID", classeur.getId());
  var url_ext = 'exportFormat=pdf&format=pdf' + '&size=A4' + '&portrait=true' + '&fitw=true&source=labnol' 
              + '&sheetnames=false&printtitle=false' + '&pagenumbers=false&gridlines=false' + '&fzr=false' + '&gid=';
  var token = ScriptApp.getOAuthToken();
  var pdfMarge = UrlFetchApp.fetch(url + url_ext + feuille.getSheetId(),{headers : {
                'Authorization' : 'Bearer ' + token }}).getBlob().setName(pdfName);

  folder.createFile(pdfMarge);
}
-----------------------
  // var destSheet = destSpreadsheet.getSheets()[0];
  // var sourceRange = sourceSheet.getRange(1,1,sourceSheet.getMaxRows(),sourceSheet.getMaxColumns());
  // var sourcevalues = sourceRange.getValues();
  // var destRange = destSheet.getRange(1, 1, destSheet.getMaxRows(), destSheet.getMaxColumns());
  // destRange.setValues(sourcevalues);
var range = destSpreadsheet.getSheetByName('SYNTHESE').getDataRange(); 
range.setValues(range.getDisplayValues());
function sauvegardeDrive() {
  // Déclaration des variables et constantes
  const classeur = SpreadsheetApp.getActiveSpreadsheet();
  const feuille = classeur.getSheetByName('SYNTHESE');
  var sheetName = "SYNTHESE";
  var folderID = "1gZEWeG4XzZDuEqDDWKaMoVolMmeLWDRI";
  var sourceSpreadsheet = SpreadsheetApp.getActive();
  var sourceSheet = sourceSpreadsheet.getSheetByName(sheetName);
  var folder = DriveApp.getFolderById(folderID);
  var semaine = feuille.getRange('B5').getValue();
  var annee = feuille.getRange('B4').getValue();
  var pdfName = "test"+semaine+"_"+annee+".pdf";

  // Pièce jointe -- this part is stealed from envoiMail() function
  var url = "https://docs.google.com/spreadsheets/d/SS_ID/export?".replace("SS_ID", classeur.getId());
  var url_ext = 'exportFormat=pdf&format=pdf' + '&size=A4' + '&portrait=true' + '&fitw=true&source=labnol' 
              + '&sheetnames=false&printtitle=false' + '&pagenumbers=false&gridlines=false' + '&fzr=false' + '&gid=';
  var token = ScriptApp.getOAuthToken();
  var pdfMarge = UrlFetchApp.fetch(url + url_ext + feuille.getSheetId(),{headers : {
                'Authorization' : 'Bearer ' + token }}).getBlob().setName(pdfName);

  folder.createFile(pdfMarge);
}

What am I missing in this kubernetes RBAC setup?

copy iconCopydownload iconDownload
kubeendpointwatcher.go:55: Failed to list *v1.Endpoints: endpoints is forbidden: User "system:serviceaccount:eng:default" cannot list resource "endpoints" in API group "" at the cluster scope
curl -v --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt -H "Authorization: Bearer $(cat /var/ru/secrets/kubernetes.io/serviceaccount/token)" https://kubernetes.default.svc/api/v1/namespaces/default/pods
-----------------------
kubeendpointwatcher.go:55: Failed to list *v1.Endpoints: endpoints is forbidden: User "system:serviceaccount:eng:default" cannot list resource "endpoints" in API group "" at the cluster scope
curl -v --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt -H "Authorization: Bearer $(cat /var/ru/secrets/kubernetes.io/serviceaccount/token)" https://kubernetes.default.svc/api/v1/namespaces/default/pods

Kubelet - Factory "crio" was unable to handle container

copy iconCopydownload iconDownload
E0623 15:44:27.039563       1 reflector.go:138] k8s.io/kubernetes/pkg/controlplane/controller/clusterauthenticationtrust/cluster_authentication_trust_controller.go:444: Failed to watch *v1.ConfigMap: failed to list *v1.ConfigMap: Get "https://[::1]:6443/api/v1/namespaces/kube-system/configmaps?limit=500&resourceVersion=0": dial tcp [::1]:6443: i/o timeout
crictl --runtime-endpoint /var/run/crio/crio.sock ps -a
crictl --runtime-endpoint /var/run/crio/crio.sock logs [id container]
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
-----------------------
E0623 15:44:27.039563       1 reflector.go:138] k8s.io/kubernetes/pkg/controlplane/controller/clusterauthenticationtrust/cluster_authentication_trust_controller.go:444: Failed to watch *v1.ConfigMap: failed to list *v1.ConfigMap: Get "https://[::1]:6443/api/v1/namespaces/kube-system/configmaps?limit=500&resourceVersion=0": dial tcp [::1]:6443: i/o timeout
crictl --runtime-endpoint /var/run/crio/crio.sock ps -a
crictl --runtime-endpoint /var/run/crio/crio.sock logs [id container]
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
-----------------------
E0623 15:44:27.039563       1 reflector.go:138] k8s.io/kubernetes/pkg/controlplane/controller/clusterauthenticationtrust/cluster_authentication_trust_controller.go:444: Failed to watch *v1.ConfigMap: failed to list *v1.ConfigMap: Get "https://[::1]:6443/api/v1/namespaces/kube-system/configmaps?limit=500&resourceVersion=0": dial tcp [::1]:6443: i/o timeout
crictl --runtime-endpoint /var/run/crio/crio.sock ps -a
crictl --runtime-endpoint /var/run/crio/crio.sock logs [id container]
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
-----------------------
E0623 15:44:27.039563       1 reflector.go:138] k8s.io/kubernetes/pkg/controlplane/controller/clusterauthenticationtrust/cluster_authentication_trust_controller.go:444: Failed to watch *v1.ConfigMap: failed to list *v1.ConfigMap: Get "https://[::1]:6443/api/v1/namespaces/kube-system/configmaps?limit=500&resourceVersion=0": dial tcp [::1]:6443: i/o timeout
crictl --runtime-endpoint /var/run/crio/crio.sock ps -a
crictl --runtime-endpoint /var/run/crio/crio.sock logs [id container]
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

Metrics-Server: Node had no addresses that matched types [InternalIP]

copy iconCopydownload iconDownload
$ kubectl get nodes worker1 -oyaml:
[...]
status:
  addresses:
  - address: worker1
    type: Hostname
  - address: 65.21.<any>.<ip>
    type: ExternalIP
- --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
-----------------------
$ kubectl get nodes worker1 -oyaml:
[...]
status:
  addresses:
  - address: worker1
    type: Hostname
  - address: 65.21.<any>.<ip>
    type: ExternalIP
- --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname

Get annotations from object in k8s event handler

copy iconCopydownload iconDownload
import (
   metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
   "k8s.io/apimachinery/pkg/runtime"
)

var metaAccessor = metav1.NewAccessor()

func (c *Controller) enqueueServiceAccount(obj interface{}) {
    if typed, ok := obj.(runtime.Object); ok {
        annotations, err := metaAccessor.Annotations(typed)
    }
}

Spring Cloud Kubernetes: Timeout waiting for informers cache to be ready

copy iconCopydownload iconDownload
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  namespace: YOUR-NAME-SPACE
  name: namespace-reader
rules:
  - apiGroups: ["", "extensions", "apps"]
    resources: ["configmaps", "pods", "services", "endpoints", "secrets"]
    verbs: ["get", "list", "watch"]

---

kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: namespace-reader-binding
  namespace: YOUR-NAME-SPACE
subjects:
- kind: ServiceAccount
  name: default
  apiGroup: ""
roleRef:
  kind: Role
  name: namespace-reader
  apiGroup: ""
-----------------------
kubectl get secrets --namespace joaomlneto
kubectl get secret/default-token-..... --template='{{.data.namespace}}' --namespace joaomlneto
-----------------------
kubectl get secrets --namespace joaomlneto
kubectl get secret/default-token-..... --template='{{.data.namespace}}' --namespace joaomlneto

unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined

copy iconCopydownload iconDownload
//go run main.go
package main

import (
    "os"
    "os/signal"
  //"context"
    "flag"
    //"fmt"
    "path/filepath"
    //"time"

    "github.com/sirupsen/logrus"
    v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
    "k8s.io/apimachinery/pkg/runtime/schema"
    "k8s.io/client-go/dynamic"
    "k8s.io/client-go/dynamic/dynamicinformer"
    //"k8s.io/client-go/rest"
    "k8s.io/client-go/tools/cache"
    "k8s.io/client-go/tools/clientcmd"
  "k8s.io/client-go/util/homedir"
)

func main() {
  //kubeconfig := os.Getenv("KUBECONFIG")
  
  var kubeconfig *string
    if home := homedir.HomeDir(); home != "" {
        kubeconfig = flag.String("kubeconfig", filepath.Join(home, ".kube", "config"), "(optional) absolute path to the kubeconfig file")
    } else {
        kubeconfig = flag.String("kubeconfig", "", "absolute path to the kubeconfig file")
    }
    flag.Parse()
  
    cfg, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)
    if err != nil {
        logrus.WithError(err).Fatal("could not get config")
    }

    // Grab a dynamic interface that we can create informers from
    dc, err := dynamic.NewForConfig(cfg)
    if err != nil {
        logrus.WithError(err).Fatal("could not generate dynamic client for config")
    }

    // Create a factory object that we can say "hey, I need to watch this resource"
    // and it will give us back an informer for it
    f := dynamicinformer.NewFilteredDynamicSharedInformerFactory(dc, 0, v1.NamespaceAll, nil)

    // Retrieve a "GroupVersionResource" type that we need when generating our informer from our dynamic factory
    gvr, _ := schema.ParseResourceArg("deployments.v1.apps")

    // Finally, create our informer for deployments!
    i := f.ForResource(*gvr)

    stopCh := make(chan struct{})
    go startWatching(stopCh, i.Informer())

    sigCh := make(chan os.Signal, 0)
    signal.Notify(sigCh, os.Kill, os.Interrupt)

    <-sigCh
    close(stopCh)
}

func startWatching(stopCh <-chan struct{}, s cache.SharedIndexInformer) {
    handlers := cache.ResourceEventHandlerFuncs{
        AddFunc: func(obj interface{}) {
            u := obj.(*unstructured.Unstructured)

            logrus.WithFields(logrus.Fields{
                "name":      u.GetName(),
                "namespace": u.GetNamespace(),
                "labels":    u.GetLabels(),
            }).Info("received add event!")
        },
        UpdateFunc: func(oldObj, obj interface{}) {
            logrus.Info("received update event!")
        },
        DeleteFunc: func(obj interface{}) {
            logrus.Info("received update event!")
        },
    }

    s.AddEventHandler(handlers)
    s.Run(stopCh)
}

Community Discussions

Trending Discussions on informer
  • Stuck with xml download using python. How to handle that?
  • Kubernetes Operators: Informers vs. reconcile loop
  • Exception: The parameters (String,String,String,(class),(class)) don't match the method signature for GmailApp.sendEmail
  • Laravel shows page 403 after form submission with French characters
  • SharedInformerFactoryWithOptions - Not able to filter based on labels
  • My page is opening a new tab and I don't know why
  • Save correctly in PDF to Drive a Google Sheet
  • What am I missing in this kubernetes RBAC setup?
  • Kubelet - Factory &quot;crio&quot; was unable to handle container
  • Metrics-Server: Node had no addresses that matched types [InternalIP]
Trending Discussions on informer

QUESTION

Stuck with xml download using python. How to handle that?

Asked 2022-Jan-13 at 18:13

I need a hint from you about an issue I'm handling. Using requests to do some webscraping in python, the URL gives me a file to download, but when I get the content from the request, I get the following result:

b'"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pg0KPERhZG9zRWNvbm9taWNvRmluYW5jZWlyb3MgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSI+DQoJPERhZG9zR2VyYWlzPg0KCQk8Tm9tZUZ1bmRvPkZJSSBCVEdQIExPR0lTVElDQTwvTm9tZUZ1bmRvPg0KCQk8Q05QSkZ1bmRvPjExODM5NTkzMDAwMTA5PC9DTlBKRnVuZG8+DQoJCTxOb21lQWRtaW5pc3RyYWRvcj5CVEcgUGFjdHVhbCBTZXJ2acOnb3MgRmluYW5jZWlyb3MgUy5BLiBEVFZNPC9Ob21lQWRtaW5pc3RyYWRvcj4NCgkJPENOUEpBZG1pbmlzdHJhZG9yPjU5MjgxMjUzMDAwMTIzPC9DTlBKQWRtaW5pc3RyYWRvcj4NCgkJPFJlc3BvbnNhdmVsSW5mb3JtYWNhbz5MdWNhcyBNYXNzb2xhPC9SZXNwb25zYXZlbEluZm9ybWFjYW8+DQoJCTxUZWxlZm9uZUNvbnRhdG8+KDExKSAzMzgzLTI1MTM8L1RlbGVmb25lQ29udGF0bz4NCgkJPENvZElTSU5Db3RhPkJSQlRMR0NURjAwMDwvQ29kSVNJTkNvdGE+DQoJCTxDb2ROZWdvY2lhY2FvQ290YT5CVExHMTE8L0NvZE5lZ29jaWFjYW9Db3RhPg0KCTwvRGFkb3NHZXJhaXM+DQoJPEluZm9ybWVSZW5kaW1lbnRvcz4NCgkJPFJlbmRpbWVudG8+DQoJCQk8RGF0YUFwcm92YWNhbz4yMDIxLTEyLTE1PC9EYXRhQXByb3ZhY2FvPg0KCQkJPERhdGFCYXNlPjIwMjEtMTItMTU8L0RhdGFCYXNlPg0KCQkJPERhdGFQYWdhbWVudG8+MjAyMS0xMi0yMzwvRGF0YVBhZ2FtZW50bz4NCgkJCTxWYWxvclByb3ZlbnRvQ290YT4wLjcyPC9WYWxvclByb3ZlbnRvQ290YT4NCgkJCTxQZXJpb2RvUmVmZXJlbmNpYT5Ob3ZlbWJybzwvUGVyaW9kb1JlZmVyZW5jaWE+DQoJCQk8QW5vPjIwMjE8L0Fubz4NCgkJCTxSZW5kaW1lbnRvSXNlbnRvSVI+dHJ1ZTwvUmVuZGltZW50b0lzZW50b0lSPg0KCQk8L1JlbmRpbWVudG8+DQoJCTxBbW9ydGl6YWNhbyB0aXBvPSIiLz4NCgk8L0luZm9ybWVSZW5kaW1lbnRvcz4NCjwvRGFkb3NFY29ub21pY29GaW5hbmNlaXJvcz4="'

and these headers:

{'Date': 'Thu, 13 Jan 2022 13:25:03 GMT', 'Set-Cookie': 'dtCookie=v_4_srv_27_sn_A24AD4C76E5194F3DB0056C40CBABEF7_perc_100000_ol_0_mul_1_app-3A97e61c3a8a7c6a0b_1_rcs-3Acss_0; Path=/; Domain=.bmfbovespa.com.br, JSESSIONID=LWB+pcQEPreUbb+BtwZ9pyOm.sfnNODE01; Path=/fnet; Secure; HttpOnly, TS01871345=011d592ce1f641d52fa6af8d3b5a924eddc7997db2f6611d8d70aeab610f5e34ea2706a45b6f2c35f2b500d01fc681c74e5caa356c; Path=/; HTTPOnly, TS01e3f871=011d592ce1f641d52fa6af8d3b5a924eddc7997db2f6611d8d70aeab610f5e34ea2706a45b6f2c35f2b500d01fc681c74e5caa356c; path=/; domain=.bmfbovespa.com.br; HTTPonly, TS01d1c2dd=011d592ce1f641d52fa6af8d3b5a924eddc7997db2f6611d8d70aeab610f5e34ea2706a45b6f2c35f2b500d01fc681c74e5caa356c; path=/fnet; HTTPonly', 'X-OneAgent-JS-Injection': 'true', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Disposition': 'attachment; filename="08706065000169-ACE28022020V01-000083505.xml"', 'Server-Timing': 'dtRpid;desc="258920448"', 'Connection': 'close', 'Content-Type': 'text/xml', 'X-XSS-Protection': '1; mode=block', 'Transfer-Encoding': 'chunked'}

But it works perfectly and download the .xml file when I point the browser to https://fnet.bmfbovespa.com.br/fnet/publico/downloadDocumento?id=247031 URL address, for example, with the following data

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DadosEconomicoFinanceiros xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <DadosGerais>
        <NomeFundo>FII BTGP LOGISTICA</NomeFundo>
        <CNPJFundo>11839593000109</CNPJFundo>
        <NomeAdministrador>BTG Pactual Serviços Financeiros S.A. DTVM</NomeAdministrador> 
        <CNPJAdministrador>59281253000123</CNPJAdministrador>
        <ResponsavelInformacao>Lucas Massola</ResponsavelInformacao>
        <TelefoneContato>(11) 3383-2513</TelefoneContato>
        <CodISINCota>BRBTLGCTF000</CodISINCota>
        <CodNegociacaoCota>BTLG11</CodNegociacaoCota>
    </DadosGerais>
    <InformeRendimentos>
        <Rendimento>
            <DataAprovacao>2021-12-15</DataAprovacao>
            <DataBase>2021-12-15</DataBase>
            <DataPagamento>2021-12-23</DataPagamento> 
            <ValorProventoCota>0.72</ValorProventoCota>
            <PeriodoReferencia>Novembro</PeriodoReferencia>
            <Ano>2021</Ano>
            <RendimentoIsentoIR>true</RendimentoIsentoIR>
        </Rendimento>
        <Amortizacao tipo=""/>
    </InformeRendimentos>
</DadosEconomicoFinanceiros>

It seems to me that the data is cryptographed, but I have no idea how to get the xml data to use the data inside it. Can you help me?

Thank you very much.

EDIT: The example code I've used is quite simple:

Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. 
>>> import requests 
>>> url='fnet.bmfbovespa.com.br/fnet/publico/downloadDocumento?id=247031' 
>>> xhtml = requests.get(url,verify=False, headers={'User-Agent':'Mozzila/5.0'}) 

Then xhtml.content command shows the string. (There is a HTTPS warning due to the verify=False that i will handle after) I have tried a solution using urllib.request, but got the same result

ANSWER

Answered 2022-Jan-13 at 18:13

Data seems to be base64 encoded. Try to decode it:

import requests 
import base64

url = 'http://fnet.bmfbovespa.com.br/fnet/publico/downloadDocumento?id=247031' 
response = requests.get(url,verify=False, headers={'User-Agent':'Mozzila/5.0'}) 
decoded = base64.b64decode(response.content)
print(decoded)

Source https://stackoverflow.com/questions/70698854

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install informer

Edit the file informer.env which contains all the required environmental variables for informer.
Head over to http://my.telegram.com/auth to authenticate your account by providing a phone number and the confirmation code sent to your phone number (or Telegram)
Once you are authenticated, click on "API Development Tools"
Go ahead and create a New Application by filling out the form shown below
You should now have the necessary parameter values for the informer.env file fields TELEGRAM_API_HASH and TELEGRAM_API_APP_ID
Go ahead and replace the values, including TELEGRAM_ACCOUNT_PHONE_NUMBER and move on to the next section
This step is optional, but if you would like to create a private group channel and would like to acquire the group ID do the following:. Set the URL in the informer.env file under the parameter TELEGRAM_NOTIFICATIONS_CHANNEL_URL. To get the channel ID simply run python3 bot.py <TELEGRAM_ACCOUNT_ID> in the app directory where <TELEGRAM_ACCOUNT_ID> is the account ID you previously generated. When the script loads, it will display all the channels you are in, simply copy this value and put it in the TELEGRAM_NOTIFICATIONS_CHANNEL_ID parameter of the informer.env file and kill the script. You're now ready to run Informer.
Create a group (or channel) and set it as private or public
Be sure to get the Telegram URL

Support

Currently a channel must have already been joined in order to begin monitoring of keywords. It is likely you will need to run the bot.py twice, once to let it join channels and another time to monitor them. I’m aware of this glaring bug and will fix it in the next revision.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Reuse Pre-built Kits with informer
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.