0

I have a python application that is fairly large when I use pyinstaller to bundle it, so I'm looking for ways to reduce its size. It uses requests, but only to make one post request. Is there a way to use a statement like from requests import ___ and still be able to make this post request? And in general, what's the best way to find documentation on the subsets of functionality that are available for import for a given python library?

Adam Zarn
  • 1,868
  • 1
  • 16
  • 42
  • Can't you get rid of requests altogether and use [urllib](https://stackoverflow.com/questions/3238925/python-urllib-urllib2-post) instead? – Selcuk Nov 06 '19 at 03:15
  • Sure I could, but I'd like to know how `requests` can be split up if at all. And I have the same question regarding `wxPython`. – Adam Zarn Nov 06 '19 at 03:19

1 Answers1

0

Answer to Question 1: You can certainly do something like this since it's only post that you need:

from requests import post

Be warned though that you'll need to re-factor your code to replace all instances where you called requests.post()

Answer to Question 2: Normally library developers provide API documentation. The standard libraries of course have their own: https://docs.python.org/3.7/library/index.html. Your miles may definitely vary depending on the library you're using. requests in particular has the documentation for post as a pydoc: enter image description here

jayg_code
  • 571
  • 8
  • 21