16

I'm attempting to integrate pyinstaller with updating feature for private repo’s. My question, is there a way to integrate pyupdater with free alternatives such as: bitbucket private repos? Pyupdater tends to work for public repo’s but I cannot workout how I can achieve this for private repo’s.

Config file:

class ClientConfig(object):
    PUBLIC_KEY = 'None'
    APP_NAME = 'dad123'
    COMPANY_NAME = 'dad123'
    UPDATE_URLS = ['ssh://git@bitbucket.org/Tysondogerz/ssh/download']
    MAX_DOWNLOAD_RETRIES = 3

Creating an ssh is easy enough:

ssh-keygen -t rsa -C "youremail@example.com"

So…

Main.py

#!/usr/bin/env python3
from __future__ import print_function
import time
import argparse
import os
import signal
import sys
import logging
from selenium import webdriver
 
logging.basicConfig(level=logging.DEBUG)
 
from client_config import ClientConfig
from pyupdater.client import Client, AppUpdate, LibUpdate
 
Ssh_key  = DWDJKWNADKJWANDJKWANDWJKDNAWJKDNWAKDNWAJDKWANDJKWANDWAJKDNWAKJDWNADKJWANDWAJKDNAWJKDNWAJKDNWAJKDWNADJKWANDJKWANDKJWADNWAJKDNWAJKNWQWQDWQNDJKQWNDJKWQNDWQJKDNWQJKDNWKJDNWKJANDWJKNDWJKNDWDUWDNWDHDUIWHDIUWHDUIWHDUIWHDIUWHDUIWHDWUDHWUIHDWUDHUhottyouremail@example.com
 
    client = Client(ClientConfig(), ssh={'ssh_key'})
     
    from pyupdater.client import Client
from client_config import ClientConfig


def print_status_info(info):
    total = info.get(u'total')
    downloaded = info.get(u'downloaded')
    status = info.get(u'status')
    print downloaded, total, status


client = Client(ClientConfig())
client.refresh()

client.add_progress_hook(print_status_info)


client = Client(ClientConfig(), refresh=True,
                        progress_hooks=[print_status_info])

lib_update = client.update_check(ASSET_NAME, ASSET_VERSION)

lib_update = client.update_check(ASSET_NAME, ASSET_VERSION, channel='beta')

if lib_update is not None:
    lib_update.download()
        driver = webdriver.Firefox()
        driver.get('http://stackoverflow.com')
 
 
if __name__ == "__main__":
    main()
djvg
  • 11,722
  • 5
  • 72
  • 103
  • If this relative path is a constant, why not simply append it to `ClientConfig.UPDATE_URLS[0]`? – Hetzroni Jan 04 '18 at 23:30
  • Upgrade your code to a [mcve]. Looks like you're getting an error to some very specific API / library call -- leave only that, the rest is irrelevant. – ivan_pozdeev Jan 06 '18 at 15:47
  • @user9099 that does not look like a full path, e.g. try this: https://bitbucket.org/Tysondogerz/dwaddwadaw/src/master – denfromufa Jan 08 '18 at 05:03
  • Are you attempting to authenticate to an HTTPS endpoint (`https://api.bitbucket.org/2.0/repositories/Tysondogerz/more/downloads`) with an SSH key? – Jim Redmond Jan 08 '18 at 19:03
  • @JimRedmond How can I adjust this link for their api to integrate access keys or oauth2 (this resembles simple auth) or other method? How can I allow people to access my repo to update the executable but only through a password/key with no limitations (no write access)? –  Jan 09 '18 at 04:31
  • 1
    Application passwords: https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html – Jim Redmond Jan 11 '18 at 05:06
  • @JimRedmond This is exactly what I am after. Although I cannot get it to download the file (authentication issues perhaps? or Wrong approach. See https://stackoverflow.com/questions/48161651/accessing-repo-with-a-bitbucket-application-password –  Jan 12 '18 at 02:20

1 Answers1

2

The Downloads section is not accessible via SSH. You'll need to use other forms of authentication over HTTPS to retrieve those files. (Application passwords may be your best option here, since they can be scoped very specifically and discarded as necessary.)

Jim Redmond
  • 4,139
  • 1
  • 14
  • 18
  • Can this be accessed without requring handing over my username and password? E.g Public repo and application password for privacy –  Jan 11 '18 at 05:14
  • I might be wrong here and this could be a good approach. So far: SSH not possible, simple auth and oauth2 require you giving others your username and password. Auth tokens give them admin access... where they still need username and password to log in. Application keys. Hopeully workable, but likely you have to hand over username and password :\ –  Jan 11 '18 at 05:17
  • Application passwords are separate from your regular password and cannot be used to log onto the GUI. You can also restrict each app password's rights. – Jim Redmond Jan 11 '18 at 05:21
  • I don't suppose you have any idea on how to implement? I'm reading some of their docs but they are for api 1.0 which is old as. –  Jan 11 '18 at 05:39
  • Thanks for your answer, it's giving me error 400. See: https://stackoverflow.com/questions/48161651/authenticates-then-redirects-then-gives-400-bad-request-for-bitbucket?noredirect=1&lq=1 –  Jan 15 '18 at 06:29