• kristof_be

    I would personally use Requests and BeautifulSoup (both modules are included by default with Pythonista).

    Furthermore, I would set up the HTTP request to use a modified User-Agent value, in order to hide that you're running this from a script, and pose as a regular web browser (note that this is not foolproof, but it helps).

    If you only need the links to the CSS, you can instruct BeautifulSoup to parse only to links, thus speeding up the process, by using the SoupStrainer class (more info here).

    Hope this helps.

    posted in Pythonista read more
  • kristof_be

    Hi,

    I'm trying to get the list of connected Bluetooth devices (regular BT, not LE, so I can't use the cb module).

    I found a topic referencing the ExternalAccessory framework, and while initially it seemed that it would only work for MFi devices, looking at this posts, it seems that the author was able to output information regarding the peripheral (Lego Mindstorms).

    The code I have so far (this is Pythonista with Python3 on iOS 12):

    from objc_util import *
    
    NSBundle = ObjCClass('NSBundle')
    ea_framework = NSBundle.bundleWithPath_('/System/Library/Frameworks/ExternalAccessory.framework')
    ea_framework.load()
    
    EAAccessoryManager = ObjCClass('EAAccessoryManager')
    accessories = EAAccessoryManager.sharedAccessoryManager().connectedAccessories()
    print(accessories)
    

    I'm not getting any errors, but it seems accessories is empty, while at least one device is connected to BT (in this case an Apple Watch).

    Just to be clear: I'm not looking to interact with BT devices, I just want to know which ones are connected. Specifically, I want to find out if my iPhone is connected to the car's BT.

    Thanks!

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!