Setting up the location manually

Issue #25 closed
mschanz created an issue

Hi,

kannst du mir sagen, wie ich manuell die Location setze? Wenn ich ojoc.py starte wird bei mir eine komplett falsche Stadt angezeigt?! Frage wäre also was da im Hintergrund passiert und gibt es eine Möglichkeit, dass ich manuell poste wo ich will. Bspw. ich spote in Aachen obwohl ich in Dresden bin.

Comments (7)

  1. Christian Fibich repo owner

    Answering in English because it might be useful to others:

    If no location is provides, OJOC/Connection.py uses an IP-to-location service to derive the location from the IP you get from your ISP. This may be off sometimes.

    You can provide a location on a city-level granularity executing ojoc.py from the command line using the -c command-line option:

    ./ojoc.py -c CITY,CC where CC is the country code (e.g, "DE", "AT", "SE" or whatever)

    e.g.,

    ./ojoc.py -c Vienna,AT sets your location to Vienna.

    The "Arrow" button in the title bar should also open a map where you can change your location.

  2. mschanz reporter

    Thanks for your fast response!

    So, if I just want to use your implementation of the "connection", I could do something like

    import OJOC.Connection
    
    def post(msg):
      c = OJOC.Connection.Connection(location=Vienna, citycc=AT)
      c.new_post(msg)
    

    and it should work fine? Because that isn't working at the moment. It looks like its posted, but I cannot see anything in my app.

  3. Christian Fibich repo owner

    OK, it should be

    Connection.Connection(citycc="Vienna,AT")

    or

    Connection.Connection(location={'city':'Vienna', 'name':'Vienna', 'country':'AT', 'loc_accuracy':100, 'loc_coordinates': {'lat':48.1, 'lng':16.2}})

  4. Christian Fibich repo owner

    EDIT: Too late

    To pass your own UID instead of querying the keyring pass it in the uid optional parameter of the constructor:

    Connection.Connection(citycc="Vienna,AT", uid="deadbeef...")

  5. Log in to comment