Giter Club home page Giter Club logo

socketlabs-python's People

Contributors

bernardharrison avatar billvolz avatar david-schrenker avatar praneethchandrathota avatar ryan-lydz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

socketlabs-python's Issues

Error in injectionresponseparser.py

On unsuccessful injections (e.g. connection error or wrong API-key) a TypeError occurs in that module:

Traceback (most recent call last): File "/usr/scripts/basic.py", line 31, in <module> response = client.send(message) File "/home/pi/.local/lib/python3.7/site-packages/socketlabs/injectionapi/socketlabsclient.py", line 104, in send return self.__send_basic_message(message) File "/home/pi/.local/lib/python3.7/site-packages/socketlabs/injectionapi/socketlabsclient.py", line 130, in __send_basic_message result = InjectionResponseParser.parse(data, response_code) File "/home/pi/.local/lib/python3.7/site-packages/socketlabs/injectionapi/core/injectionresponseparser.py", line 92, in parse injection_response = get_injection_response_dto(response) File "/home/pi/.local/lib/python3.7/site-packages/socketlabs/injectionapi/core/injectionresponseparser.py", line 63, in get_injection_response_dto for item in dct['MessageResults']: TypeError: 'NoneType' object is not iterable

You can test it with your basic send example.

Frequent KeyError: 'InvalidFromAddress' traceback messages despite working some of the time

I have the following code snippet that works some of the time, but more often that not results in a traceback indicating KeyError: 'InvalidFromAddress'

I am using python 3.10

    def __notifySend(self, to_email: str, from_email: str) -> None: 
        msg = BasicMessage()
        slc = SocketLabsClient(
            int(str(os.getenv("SOCKETLABS_SERVER_ID"))),
            str(os.getenv("SOCKETLABS_API_KEY"))
        )
        msg.subject             = "Suspected troll found!"
        msg.html_body           = "<html>Busted!</html>"
        msg.plain_text_body     = "We got 'im boys!"
        msg.from_email_address  = EmailAddress(from_email)
        msg.to_email_address.append(EmailAddress(to_email))

        response = slc.send(msg)
        print(response)
        return

I am not sure why this would be the case, as the method more or less follows exactly what the documentation suggests, and sometimes it works as expected. I have tested this on two separate known-good email addresses and can confirm that when the code does what it is supposed to, they appear in my inbox as expected.

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.