Question

Python line errors regarding module install (Patreon)

  • 23 November 2023
  • 4 replies
  • 66 views

Hello, I am having some issues obtaining python modules to use in zaps.

 

Code that is not working:

pip or pip3 install webbot
from webbot import Browser

web = Browser()
web.go to('https://patreon.com/login')
web.type('mail@mailaddress.com', into='EMAIL') web.type('password', into='PASSWORD')
web.click('Login')

 

Error Message:

Failed to run your Python code

Your code had an error! Traceback (most recent call last): SyntaxError: invalid syntax (<string>, line 8)

 

My goal is to take a post I make on facebook and to copy the information as a post to Patreon, but since no native Patreon integrations do this, I decided to enlist the help of python libraries, how feasible is this. For example, in the code above I am attempting to use the webbot libraries to login automatically before creating a post... 

 

The first line alone creates the error ...

 


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Userlevel 7
Badge +14

Hi @zdlaughlin 

Good question.

Help: https://help.zapier.com/hc/en-us/articles/8496326417549-Use-Python-code-in-Zaps#h_01H9FNT4XPJ17N5WX0BA6Z0NKC

Limitations with Code steps

  • You cannot require external libraries or install libraries commonly referred to as "pip modules".
  • Only the standard Python library and requests are available in the Code app and requests is already included in the namespace.

Interesting, got you! Is there any sort of way to access the information in those modules perhaps indirectly say as a stored variable?

Userlevel 7
Badge +14

@zdlaughlin

Help articles and examples for using the Code app: https://zapier.com/apps/code/help

Userlevel 1
Badge

Dear @zdlaughlin ,

 

Regarding the issue your are have with Zaps library limitations, you could attempt a few different methods of approach:

 

    Direct Approach:

        Switch to `urllib` in Python: While it's true that `urllib` isn't as straightforward as requests, it's still a solid option within Zapier. It does need more intricate

    coding, but it's quite capable of handling basic HTTP requests.

 

    Alternative Solutions:

        Try Out Zapier's "Webhooks": Zapier's "Webhooks by Zapier" could be a simpler solution. This feature allows you to perform HTTP requests like GET, POST, and PUT directly

    This means you can avoid using Python for these specific tasks. Plus, for more complex data processing, you can combine these webhooks with Python scripts, offering you more versatility in managing intricate workflows.

 

    Useful Tool:

        I have found that when debugging and testing functionalities involving API requests; Using PostMan simplifies the process, it also provides automated scripts ina a variety of languages and frameworks, so once you have accomplished a successful test, you can easily copy and paste working blocks of code straight into the Zapier Python block.


 

Consider External Services for More Complex Needs: In cases where you need more than what Zapier offers, external platforms like AWS Lambda or Google Cloud Functions could be the other way to go, but that would depend on the scale and volume of your project requirements. They support comprehensive Python scripting along with a wider range of libraries. You can then integrate these services back into your Zapier workflows, giving you additional functionality.

 

Did these solutions fix your problem? If you need more help, feel free to contact us directly for support.

 

Best Regards,

Dillon Breytenbach

DashSquared Team

LinkdeIn DashSquared