4339 links
  • Arnaud's links
  • Home
  • Login
  • RSS Feed
  • ATOM Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
page 1 / 1
97 results tagged python x
  • thumbnail
    safety · PyPI
    March 9, 2023 at 4:30:56 PM GMT+1 - permalink - archive.org - https://pypi.org/project/safety/
    python scan security
  • Note: pas besoin de requirements.txt en local si on a un setup.py

    virtualenv venv
    . venv/bin/activate
    pip install --editable .

    May 24, 2022 at 11:43:53 AM GMT+2 - permalink - archive.org - https://links.infomee.fr/?ruUKGA
    dev python
  • thumbnail
    Auto activate and deactivate python venv using zsh - DEV Community
    python_venv() {
      MYVENV=./venv
      # when you cd into a folder that contains $MYVENV
      [[ -d $MYVENV ]] && source $MYVENV/bin/activate > /dev/null 2>&1
      # when you cd into a folder that doesn't
      [[ ! -d $MYVENV ]] && deactivate > /dev/null 2>&1
    }
    autoload -U add-zsh-hook
    add-zsh-hook chpwd python_venv
    May 20, 2022 at 1:59:01 PM GMT+2 * - permalink - archive.org - https://dev.to/moniquelive/auto-activate-and-deactivate-python-venv-using-zsh-4dlm
    python venv zsh
  • Regular Expression HOWTO — Python 3.10.4 documentation

    named group

    May 18, 2022 at 9:36:46 AM GMT+2 - permalink - archive.org - https://docs.python.org/3/howto/regex.html
    group named python re
  • IPAM — pynetbox 6.6.2.dev7+g0f1e588 documentation
    May 4, 2022 at 1:56:18 PM GMT+2 * - permalink - archive.org - https://pynetbox.readthedocs.io/en/latest/IPAM.html
    ipam lib netbox network python
  • thumbnail
    GitHub - Textualize/rich: Rich is a Python library for rich text and beautiful formatting in the terminal.
    • https://pypi.org/project/simple-term-menu/
    • https://click.palletsprojects.com/en/8.1.x/
    May 4, 2022 at 9:58:14 AM GMT+2 - permalink - archive.org - https://github.com/Textualize/rich
    color format python terminal
  • thumbnail
    Regardez "Reuven M. Lerner - Practical decorators - PyCon 2019" sur YouTube

    You want to really understand decorators? Watch this video!

    boilerplate:

    import functools
    
    def decorator(func):
        @functools.wraps(func)
        def wrapper_decorator(*args, **kwargs):
            # Do something before
            value = func(*args, **kwargs)
            # Do something after
            return value
        return wrapper_decorator
    • https://realpython.com/primer-on-python-decorators/
    February 11, 2022 at 8:30:18 PM GMT+1 * - permalink - archive.org - https://youtu.be/MjHpMCIvwsY
    decorators python
  • Specifications — The Hitchhiker's Guide to Packaging 1.0 documentation

    When you want to publish a beta version, you can use a special tag that won't be proposed to client using pip install package --upgrade
    example :
    current version = 3.0.1
    next version = 3.1.0

    I can tag with 3.1.0-alpha.1

    pip install --upgrade won't upgrade to this version but pip install package==3.1.0-alpha.1 will

    February 7, 2022 at 11:19:29 AM GMT+1 - permalink - archive.org - https://the-hitchhikers-guide-to-packaging.readthedocs.io/en/latest/specification.html
    python semver
  • thumbnail
    python - Django template can't loop defaultdict - Stack Overflow

    django template does not like defaultdict, 2 solutions:
    1) set default_factory to None
    or
    2) cast defaultdict to a simpledict

    "The template variable resolution algorithm in Django will attempt to resolve new_data.items as new_data['items'] first, which resolves to an empty list when using defaultdict(list)."

    December 29, 2021 at 11:19:35 AM GMT+1 - permalink - archive.org - https://stackoverflow.com/questions/4764110/django-template-cant-loop-defaultdict
    defaultdict django python
  • thumbnail
    Show some equivalent list comprehensions in filter examples · Issue #1068 · pallets/jinja · GitHub
    # filter out all elements not with x > 5
    a = [el for el in data if el['x'] > 5]
    
    # get all the 'c' attributes as a list
    b = [el['c'] for el in data]
    
    # get all the 'c' attributes for the elements with x > 5
    c = [el['c'] for el in data if el['x'] > 5]
    
    In Jinja2:
    
    a: {{ data | selectattr('x', 'gt', 5) | list }}
    b: {{ data | map(attribute='c') | list }} 
    c: {{ data | selectattr('x', 'gt', 5) | map(attribute='c') | list }} 
    September 24, 2021 at 11:47:44 AM GMT+2 * - permalink - archive.org - https://github.com/pallets/jinja/issues/1068
    ansible comprehension list python
  • thumbnail
    OSX crash complaining of operation `in progress in another thread when fork() was called` · Issue #32499 · ansible/ansible · GitHub

    Ce truc obscur qui t'arrive et où la solution se trouve au fond d'une PR

    export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

    August 4, 2021 at 4:12:06 PM GMT+2 - permalink - archive.org - https://github.com/ansible/ansible/issues/32499
    ansible mac python
  • thumbnail
    python - How to search and replace text in a file? - Stack Overflow
    Sometime you cant use sed :(

    # Read in the file
    with open('file.txt', 'r') as file :
      filedata = file.read()

    # Replace the target string
    filedata = filedata.replace('ram', 'abcd')

    # Write the file out again
    with open('file.txt', 'w') as file:
      file.write(filedata)
    July 7, 2021 at 4:42:22 PM GMT+2 * - permalink - archive.org - https://stackoverflow.com/questions/17140886/how-to-search-and-replace-text-in-a-file
    python replace
  • thumbnail
    Creating the Perfect Python Dockerfile | by Luis Sena | May, 2021 | Medium
    May 21, 2021 at 10:21:09 AM GMT+2 - permalink - archive.org - https://luis-sena.medium.com/creating-the-perfect-python-dockerfile-51bdec41f1c8
    docker gunicorn python
  • thumbnail
    pantsbuild/pex: A library and tool for generating .pex (Python EXecutable) files
    May 12, 2021 at 2:34:08 PM GMT+2 - permalink - archive.org - https://github.com/pantsbuild/pex
    packaging python
  • thumbnail
    jazzband/pip-tools: A set of tools to keep your pinned Python dependencies fresh.

    python dependency management with lock file

    May 12, 2021 at 2:27:40 PM GMT+2 - permalink - archive.org - https://github.com/jazzband/pip-tools
    pip python
  • Welcome to Invoke! — Invoke documentation
    March 17, 2021 at 3:55:20 PM GMT+1 - permalink - archive.org - http://www.pyinvoke.org/
    cli invoke python tools
  • Note: debug python terminal

    ++++++++++++++++++++++
    Version avec interface cmd
    ++++++++++++++++++++++

    Prérequis :

    pip install pudb

    Pour docker, dans le docker compose ajouter

    stdin_open: true
    tty: true
    Faire docker attach container_name

    Comment break/debug :

    Là où on veut break, il suffit de coller cette ligne : import pudb; pu.db

    Dans le terminal où on a fait docker attach on doit voir l'interface de pudb

    ++++++++++++++++++++++
    Version + simple
    ++++++++++++++++++++++
    Prérequis : python 3.7

    Pour docker, dans le docker compose ajouter

    stdin_open: true
    tty: true
    Faire docker attach container_name

    Comment break/debug :

    breakpoint()

    Dans le terminal où on a fait docker attach on doit voir un prompt

    On peut print les variables
    "continue" pour continuer

    February 12, 2021 at 10:37:06 AM GMT+1 * - permalink - archive.org - https://links.infomee.fr/?lTcZoA
    debug pudb python terminal
  • thumbnail
    GitHub - zestyping/q: Quick and dirty debugging output for tired programmers. ⛺
    January 30, 2021 at 10:47:08 AM GMT+1 - permalink - archive.org - https://github.com/zestyping/q
    debug lazy python
  • thumbnail
    colorama · PyPI
    January 8, 2021 at 10:03:06 AM GMT+1 - permalink - archive.org - https://pypi.org/project/colorama/
    color python
  • Advanced usage of Python requests - timeouts, retries, hooks
    December 13, 2020 at 8:04:04 PM GMT+1 - permalink - archive.org - https://findwork.dev/blog/advanced-usage-python-requests-timeouts-retries-hooks/
    python requests retry
  • Python logging - under the hood
    November 30, 2020 at 3:55:54 PM GMT+1 - permalink - archive.org - https://blog.urbanpiper.com/understanding-python-logging-library/
    log python
  • Rate limiting using Python and Redis
    November 14, 2020 at 3:08:34 PM GMT+1 - permalink - archive.org - https://www.hackdoor.io/articles/rate-limiting-using-python-and-redis-9b7dbce8c7a5
    python rate ratelimiter
  • thumbnail
    73 Examples to Help You Master Python's f-strings
    November 14, 2020 at 3:03:10 PM GMT+1 - permalink - archive.org - https://miguendes.me/73-examples-to-help-you-master-pythons-f-strings
    python string
  • Time zones | Django documentation | Django
    November 6, 2020 at 5:55:45 PM GMT+1 - permalink - archive.org - https://docs.djangoproject.com/en/3.1/topics/i18n/timezones/
    django python timezone
  • thumbnail
    python - Displaying a timedelta object in a django template - Stack Overflow

    Here's my filter code

    from django import template

    register = template.Library()

    @register.filter()
    def smooth_timedelta(timedeltaobj):
    """Convert a datetime.timedelta object into Days, Hours, Minutes, Seconds."""
    secs = timedeltaobj.total_seconds()
    timetot = ""
    if secs > 86400: # 60sec 60min 24hrs
    days = secs // 86400
    timetot += "{} days".format(int(days))
    secs = secs - days*86400

    if secs > 3600:
        hrs = secs // 3600
        timetot += " {} hours".format(int(hrs))
        secs = secs - hrs*3600
    
    if secs > 60:
        mins = secs // 60
        timetot += " {} minutes".format(int(mins))
        secs = secs - mins*60
    
    if secs > 0:
        timetot += " {} seconds".format(int(secs))
    return timetot

    Then in my template I did

    {% load smooth_timedelta %}

    {% timedeltaobject|smooth_timedelta %}

    October 29, 2020 at 10:25:50 AM GMT+1 - permalink - archive.org - https://stackoverflow.com/questions/16348003/displaying-a-timedelta-object-in-a-django-template
    django filter python
  • Note: python natural sort

    def atoi(text):
    return int(text) if text.isdigit() else text

    def natural_keys(text):
    return [ atoi(c) for c in re.split(r'(\d+)', text) ]

    my_list.sort(key=natural_keys)

    October 9, 2020 at 3:01:43 PM GMT+2 - permalink - archive.org - https://links.infomee.fr/?6OC8rw
    python sort
  • Everything You Need to Know About Python's Namedtuples
    October 4, 2020 at 5:03:53 PM GMT+2 - permalink - archive.org - https://miguendes.me/everything-you-need-to-know-about-pythons-namedtuples-ckfim70u102jbots197jn0zmh#why-should-i-use-namedtuples
    data namedtuple python type
  • typing — Support for type hints — Python 3.8.6 documentation
    October 4, 2020 at 4:50:14 PM GMT+2 - permalink - archive.org - https://docs.python.org/3/library/typing.html
    python typing
  • thumbnail
    Making Concurrent HTTP requests with Python AsyncIO | LAAC Technology
    October 4, 2020 at 4:49:58 PM GMT+2 - permalink - archive.org - https://www.laac.dev/blog/concurrent-http-requests-python-asyncio/
    async python
  • thumbnail
    simple-term-menu · PyPI

    Au top pour faire des petits helper en cmd line

    October 2, 2020 at 3:26:36 PM GMT+2 - permalink - archive.org - https://pypi.org/project/simple-term-menu/
    interactif menu python
  • thumbnail
    Primer on Python Decorators – Real Python
    September 17, 2020 at 11:30:06 AM GMT+2 - permalink - archive.org - https://realpython.com/primer-on-python-decorators/#debugging-code
    decorator python
  • Note: str to bool

    from distutils.util import strtobool

    bool(strtobool('true'))

    FOO = bool(strtobool(os.environ['FOO']))

    September 7, 2020 at 11:52:44 AM GMT+2 * - permalink - archive.org - https://docs.python.org/3/distutils/apiref.html#distutils.util.strtobool
    boolean python
  • Benchmarks - FastAPI
    September 2, 2020 at 2:51:05 PM GMT+2 - permalink - archive.org - https://fastapi.tiangolo.com/benchmarks/
    async fastapi python web
  • thumbnail
    How to hide output of subprocess in Python 2.7 - Stack Overflow

    retcode = subprocess.call(['echo', 'foo'], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)

    July 30, 2020 at 5:00:46 PM GMT+2 * - permalink - archive.org - https://stackoverflow.com/questions/11269575/how-to-hide-output-of-subprocess-in-python-2-7
    null python stdout
  • Welcome to Click — Click Documentation (7.x)
    July 8, 2020 at 11:54:37 AM GMT+2 - permalink - archive.org - https://click.palletsprojects.com/en/7.x/
    arg python
  • JSON Schema | The home of JSON Schema
    June 4, 2020 at 10:41:39 AM GMT+2 - permalink - archive.org - https://json-schema.org/
    json python validation
  • pytz - World Timezone Definitions for Python — pytz 2014.10 documentation
    May 29, 2020 at 10:52:27 AM GMT+2 - permalink - archive.org - http://pytz.sourceforge.net/
    python timezone
  • Logging Cookbook — Python 3.8.3rc1 documentation
    May 14, 2020 at 9:41:12 AM GMT+2 - permalink - archive.org - https://docs.python.org/3/howto/logging-cookbook.html
    cookbook log python
  • Apache Hadoop Amazon Web Services support – Working with IAM Assumed Roles
    April 23, 2020 at 4:00:22 PM GMT+2 - permalink - archive.org - https://hadoop.apache.org/docs/current/hadoop-aws/tools/hadoop-aws/assumed_roles.html#AccessDeniedException_.2B_AmazonDynamoDBException
    assume hadoop python role spark
  • Apache Hadoop Amazon Web Services support – Working with IAM Assumed Roles
    April 22, 2020 at 5:23:26 PM GMT+2 - permalink - archive.org - https://hadoop.apache.org/docs/current/hadoop-aws/tools/hadoop-aws/assumed_roles.html
    assume aws hadoop python role spark
  • thumbnail
    GitHub - davidhalter/jedi-vim: Using the jedi autocompletion library for VIM.
    April 22, 2020 at 8:39:53 AM GMT+2 - permalink - archive.org - https://github.com/davidhalter/jedi-vim
    python vim
  • thumbnail
    How to Make a Discord Bot in Python – Real Python
    April 21, 2020 at 4:33:00 PM GMT+2 - permalink - archive.org - https://realpython.com/how-to-make-a-discord-bot-python/#using-utility-functions
    bot discord python
  • thumbnail
    Speed Up Your Python Program With Concurrency – Real Python
    April 21, 2020 at 3:05:46 PM GMT+2 - permalink - archive.org - https://realpython.com/python-concurrency/#synchronous-version
    async await cpu python thread
  • thumbnail
    GitHub - containrrr/watchtower: A process for automating Docker container base image updates.

    un container qui va update les autres containers si une image plus récente a été trouvée (stop, rm, pull, recreate)
    Pratique sur serveur perso pour les choses qui tournent en latest
    Implémentation en Go, il y a le pendant python ici : https://github.com/pyouroboros/ouroboros

    April 11, 2020 at 11:32:56 AM GMT+2 - permalink - archive.org - https://github.com/containrrr/watchtower
    auto docker go python update
  • Note:

    datetime.date.today().strftime("%Y-%m-%d")
    datetime.datetime.now().strftime("%Y-%m-%d %H:%M")

    March 24, 2020 at 11:27:50 AM GMT+1 * - permalink - archive.org - https://links.infomee.fr/?Aw6ttQ
    date python
  • Pluralsight Tech Blog | Porting Flask to FastAPI for ML Model Serving
    December 26, 2019 at 7:02:53 PM GMT+1 * - permalink - archive.org - https://www.pluralsight.com/tech-blog/porting-flask-to-fastapi-for-ml-model-serving/
    ds python
  • thumbnail
    Using Python Threading and Returning Multiple Results (Tutorial) | Shane Lynn
    October 18, 2019 at 10:05:31 AM GMT+2 - permalink - archive.org - https://www.shanelynn.ie/using-python-threading-for-multiple-results-queue/
    python thread
  • thumbnail
    GitHub - MichaelAquilina/zsh-autoswitch-virtualenv: 🐍 ZSH plugin to automatically switch python virtualenvs and Pipenvs as you move between directories
    October 10, 2019 at 10:53:05 AM GMT+2 - permalink - archive.org - https://github.com/MichaelAquilina/zsh-autoswitch-virtualenv
    plugin python venv
  • thumbnail
    GitHub - jkehler/awslambda-psycopg2
    September 2, 2019 at 11:05:19 AM GMT+2 * - permalink - archive.org - https://github.com/jkehler/awslambda-psycopg2
    aws lambda postgresql psycopg2 python
  • Writing a Kubernetes Operator in Python without frameworks and SDK

    simple example on how to write a kubernetes operator

    August 16, 2019 at 4:26:20 PM GMT+2 - permalink - archive.org - https://medium.com/flant-com/kubernetes-operator-in-python-451f2d2e33f3
    k8s operator python
  • thumbnail
    AWS re:Invent 2014 | (DEV307) Introduction to Version 3 of the AWS SDK for Python (Boto) - YouTube
    May 12, 2019 at 8:30:08 PM GMT+2 - permalink - archive.org - https://www.youtube.com/watch?v=Cb2czfCV4Dg
    aws boto3 python
  • thumbnail
    Project Jupyter | Home
    April 19, 2019 at 10:06:29 AM GMT+2 - permalink - archive.org - https://jupyter.org/
    notebook python wiki
  • Convert cURL command syntax to Python requests, Node.js, R, PHP and Go code

    via pierrick

    November 19, 2018 at 2:23:53 PM GMT+1 - permalink - archive.org - https://curl.trillworks.com/
    curl python requests
  • thumbnail
    PyMySQL · PyPI
    September 25, 2018 at 1:49:37 PM GMT+2 - permalink - archive.org - https://pypi.org/project/PyMySQL/
    mysql python
  • How to use *args and **kwargs in Python - SaltyCrane Blog
    September 18, 2018 at 3:07:27 PM GMT+2 - permalink - archive.org - https://www.saltycrane.com/blog/2008/01/how-to-use-args-and-kwargs-in-python/
    args function kwargs python
  • Note: Python log tee

    pour ne pas bufferiser l'ouput d'un script python et avoir le résultat en direct dans un | tee -a :
    python -u script.py | tee -a mon.log

    September 13, 2018 at 4:52:12 PM GMT+2 - permalink - archive.org - https://links.infomee.fr/?F1LIUA
    python tee
  • thumbnail
    GitHub - TheAlgorithms/Python: All Algorithms implemented in Python
    June 28, 2018 at 1:56:01 PM GMT+2 - permalink - archive.org - https://github.com/TheAlgorithms/Python
    algo code python
  • Python-programming-exercises/100+ Python challenging programming exercises.txt at master · zhiwehu/Python-programming-exercises · GitHub
    May 28, 2018 at 9:25:38 AM GMT+2 - permalink - archive.org - https://github.com/zhiwehu/Python-programming-exercises/blob/master/100%2B%20Python%20challenging%20programming%20exercises.txt
    algo code dev python
  • Quickstart — Requests 2.18.4 documentation

    Good to know because it hurts me so bad:
    When doing a put/post request with requests library, if the response is a redirect, request do the request again BUT with GET method...

    -,-

    January 11, 2018 at 10:58:59 AM GMT+1 - permalink - archive.org - http://docs.python-requests.org/en/master/user/quickstart/#redirection-and-history
    python redirect requests
  • Note: python SimpleHTTPServer

    python -m SimpleHTTPServer 8000

    python -m http.server 8000

    November 28, 2017 at 11:56:32 AM GMT+1 * - permalink - archive.org - https://links.infomee.fr/?rAuVpg
    http python
  • thumbnail
    python - Print in terminal with colors? - Stack Overflow

    def print_format_table():
    """
    prints table of formatted text format options
    """
    for style in range(8):
    for fg in range(30,38):
    s1 = ''
    for bg in range(40,48):
    format = ';'.join([str(style), str(fg), str(bg)])
    s1 += '\x1b[%sm %s \x1b[0m' % (format, format)
    print(s1)
    print('\n')

    print_format_table()

    November 17, 2017 at 9:37:26 AM GMT+1 - permalink - archive.org - https://stackoverflow.com/questions/287871/print-in-terminal-with-colors
    color python terminal
  • thumbnail
    Apache Libcloud is a standard Python library that abstracts away differences among multiple cloud provider APIs | Apache Libcloud

    utopie ^^

    November 17, 2017 at 9:34:14 AM GMT+1 - permalink - archive.org - https://libcloud.apache.org/
    cloud lib python
  • Logging HOWTO — Python 3.6.2rc2 documentation

    python3 log to file AND stdout
    import logging
    logging.basicConfig(handlers=[logging.FileHandler('/var/log/runner/process1.log'),logging.StreamHandler()],format='%(asctime)s %(levelname)s %(message)s',level=logging.INFO)

    logging.info('foo')

    Encore mieux pour supporter le logrotate sans copytruncate :
    import logging.handlers
    logging.basicConfig(handlers=[logging.handlers.WatchedFileHandler('/var/log/worker/worker1.log'),logging.StreamHandler()],format='%(asctime)s %(levelname)s %(message)s',level=logging.INFO)

    /var/log/worker/*.log {
    monthly
    rotate 12
    compress
    delaycompress
    missingok
    notifempty
    create 644 root root
    }

    Python 2:

    import logging as loggingg

    logging = loggingg.getLogger('simple_example')
    logging.setLevel(loggingg.INFO)

    formatter = loggingg.Formatter('%(asctime)s %(levelname)s %(message)s')

    console_handler = loggingg.StreamHandler()
    console_handler.setLevel(loggingg.INFO)
    console_handler.setFormatter(formatter)

    file_handler = loggingg.FileHandler('/var/log/worker/worker3.log')
    file_handler.setLevel(loggingg.INFO)
    file_handler.setFormatter(formatter)

    logging.addHandler(console_handler)
    logging.addHandler(file_handler)

    July 11, 2017 at 10:05:21 AM GMT+2 * - permalink - archive.org - https://docs.python.org/3/howto/logging.html
    log logrotate python
  • Note: some draft about monitoring beanstalk applications health with boto3 python script
    import pprint
    p = pprint.PrettyPrinter(indent=4)
    p.pprint(x)

    or

    import pprint
    pprint.pformat(x)


    import logging
    import pprint
    logging.info(pprint.pformat(dict))



     $ cat monitor_beanstalk.py
    #!/bin/python

    import boto3
    import pprint
    pp = pprint.PrettyPrinter(indent=4)


    #List all env and status and instances health

    client = boto3.client('elasticbeanstalk')


    envs = client.describe_environments()['Environments']

    #pp.pprint(envs)


    for env in envs:
        print 'ApplicationName: {} EnvironmentName: {} Health: {} HealthStatus: {} Status: {}'.format(env['ApplicationName'].ljust(30),env['EnvironmentName'].ljust(30),env['Health'].ljust(10),env.get('HealthStatus', 'N/A').ljust(10),env['Status'].ljust(10))
        if (env['Health'] != 'Green') or (env.get('HealthStatus', 'N/A') != 'Ok' and env.get('HealthStatus', 'N/A') != 'N/A'):
            print '\nProblem'
            details = client.describe_environment_health(EnvironmentName=env['EnvironmentName'],AttributeNames=['All'])
            #pp.pprint(details)
            print details['Causes']
            print details['InstancesHealth']
            print '\n'
    June 15, 2017 at 11:12:05 AM GMT+2 * - permalink - archive.org - https://links.infomee.fr/?eFFzMg
    aws beanstalk boto pprint python
  • Note: find/sed equivalent in python

    for root, dirs, files in os.walk("folder"):
    for file in files:
    if file.endswith(".yml"):
    print(os.path.join(root, file))
    with open(os.path.join(root, file), "r") as sources:
    lines = sources.readlines()
    with open(os.path.join(root, file), "w") as sources:
    for line in lines:
    sources.write(re.sub(r'pattern', 'foo', line))

    May 29, 2017 at 2:15:06 PM GMT+2 - permalink - archive.org - https://links.infomee.fr/?Y803hg
    find python sed
  • https://pypi.python.org/pypi/awscli/json

    Add /json to pypi package url.. Magic!

    May 4, 2017 at 2:11:45 PM GMT+2 - permalink - archive.org - https://pypi.python.org/pypi/awscli/json
    pip python
  • Stupid Python Tricks: The KeyboardInterrupt Exception
    catching all exception in python
    import traceback

    for record in database:
        try:
            blabla
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception as e:
            # report error and proceed
            print(type(e).__name__)
            print(e)
            print(traceback.format_exc())

    Ne pas oublier de raise si on veut re-raise
           
    April 21, 2017 at 4:19:03 PM GMT+2 * - permalink - archive.org - http://effbot.org/zone/stupid-exceptions-keyboardinterrupt.htm
    exception python
  • Note: boto3 subnet sorted by name

    subnets = ec2.subnets.all()
    subnets_sorted = sorted(subnets, key=lambda k: k.tags[next(index for (index, d) in enumerate(k.tags) if d["Key"] == "Name")]['Value'])

    Well, my python level is not good enough to clearly understand this but my Google level was largely enough to build this

    March 24, 2017 at 4:02:34 PM GMT+1 - permalink - archive.org - https://links.infomee.fr/?Fn--jw
    aws boto boto3 python
  • Tutorial: Todo-List Application — Bottle 0.12.13 documentation

    Running Bottle with a different server

    As said above, the standard server is perfectly suitable for development, personal use or a small group of people only using your application based on Bottle. For larger tasks, the standard server may become a bottleneck, as it is single-threaded, thus it can only serve one request at a time.

    But Bottle has already various adapters to multi-threaded servers on board, which perform better on higher load. Bottle supports Cherrypy, Fapws3, Flup and Paste.

    If you want to run for example Bottle with the Paste server, use the following code:

    from bottle import PasteServer
    ...
    run(server=PasteServer)

    This works exactly the same way with FlupServer, CherryPyServer and FapwsServer.

    March 2, 2017 at 9:09:38 PM GMT+1 - permalink - archive.org - https://bottlepy.org/docs/stable/tutorial_app.html#server-setup
    bottle python
  • thumbnail
    logging - How to log into a file for a python & bottle web server? - Stack Overflow

    import logging
    logging.basicConfig(filename='log.txt', format=logging.BASIC_FORMAT)
    logging.error('OH NO!')
    try:
    raise Exception('Foo')
    except:
    logging.exception("Oops:")

    March 2, 2017 at 8:56:16 PM GMT+1 - permalink - archive.org - http://stackoverflow.com/questions/15444695/how-to-log-into-a-file-for-a-python-bottle-web-server
    bottle log python
  • Quickstart — Boto 3 Docs 1.4.0 documentation
    September 29, 2016 at 11:16:39 AM GMT+2 - permalink - archive.org - http://boto3.readthedocs.io/en/latest/guide/quickstart.html
    aws boto python
  • Kit SDK AWS pour Python

    Un sdk en python pour aws

    https://boto3.readthedocs.io/en/latest/guide/resources.html

    August 16, 2016 at 5:40:40 PM GMT+2 - permalink - archive.org - https://aws.amazon.com/fr/sdk-for-python/
    aws python sdk
  • The 10 Most Common Mistakes That Python Programmers Make | Toptal

    via sebsauvage

    February 23, 2016 at 9:57:51 AM GMT+1 - permalink - archive.org - http://www.toptal.com/python/top-10-mistakes-that-python-programmers-make
    common error python
  • Random writings and thoughts about Python: psutil 4.0.0 and how to get "real" process memory and environ in Python
    February 18, 2016 at 10:55:56 AM GMT+1 - permalink - archive.org - http://grodola.blogspot.com/2016/02/psutil-4-real-process-memory-and-environ.html
    memory ps psutil python
  • Notions de Python avancées • Tutoriels • Zeste de Savoir

    Un cours en français qui a l'air très bien. Via sametmax sur twitter

    January 1, 2016 at 10:21:09 AM GMT+1 - permalink - archive.org - http://zestedesavoir.com/tutoriels/954/notions-de-python-avancees/
    python
  • thumbnail
    RedisLabs/redis-migrate

    useful script to migrate redis server without downtime

    • http://boomboomboom.biz/blog/2013/09/07/migrate-redis-to-a-new-server-without-downtime/
    November 9, 2015 at 2:55:05 PM GMT+1 - permalink - archive.org - https://github.com/RedisLabs/redis-migrate
    migrate python redis
  • Cue/scales

    Pratique pour avoir des stat rapidement dans ses scripts python (si on n'a pas de stack graphite sous la main)

    May 4, 2015 at 3:02:46 PM GMT+2 - permalink - archive.org - https://github.com/Cue/scales
    metric python
  • thumbnail
    unix - How can I pretty-print JSON? - Stack Overflow

    How to pretty print a json string :

    cat pref.json | python -m json.tool

    for uuoc nazi ;) :

    < pref.json python -m json.tool
    or
    python -m json.tool < pref.json

    September 3, 2014 at 10:33:46 AM GMT+2 - permalink - archive.org - http://stackoverflow.com/questions/352098/how-can-i-pretty-print-json
    commandline json linux pretty print python
  • What happens if you write a TCP stack in Python? - Julia Evans

    Pour le fun et le learning : faire du tcp avec python / scapy

    via sametmax

    August 12, 2014 at 9:18:00 PM GMT+2 - permalink - archive.org - http://jvns.ca/blog/2014/08/12/what-happens-if-you-write-a-tcp-stack-in-python/
    networking python scapy
  • Welcome to web.py! (web.py)

    mini web framework en python, dans le meme genre que bottle :
    http://bottlepy.org/docs/dev/index.html

    July 7, 2014 at 10:56:12 AM GMT+2 - permalink - archive.org - http://webpy.org/
    framework python web
  • sh 1.08 — sh v1.08 documentation

    une lib pour interagir facilement avec bash

    June 24, 2014 at 3:58:40 PM GMT+2 - permalink - archive.org - http://amoffat.github.io/sh/
    python
  • 30 Python Language Features and Tricks You May Not Know About
    May 19, 2014 at 1:40:48 PM GMT+2 - permalink - archive.org - http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html
    python
  • Gunicorn - Python WSGI HTTP Server for UNIX

    Un serveur http wsgi en python, pour faire tourner du django. A voir si les perf sont meilleure qu'avec le mod apache

    • https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/gunicorn/
    February 7, 2014 at 11:30:05 AM GMT+1 - permalink - archive.org - http://gunicorn.org/#quickstart
    python
  • The uWSGI project — uWSGI 2.0 documentation

    L'équivalent de php-fpm pour python (mettre un nginx devant)

    • https://github.com/unbit
    February 7, 2014 at 11:28:28 AM GMT+1 - permalink - archive.org - http://uwsgi-docs.readthedocs.org/en/latest/
    python
  • Bottle: Python Web Framework — Bottle 0.13-dev documentation

    Python Web Framework

    February 7, 2014 at 11:27:32 AM GMT+1 - permalink - archive.org - http://bottlepy.org/docs/dev/index.html
    framework python
  • Twisted

    Twisted is an event-driven networking engine written in Python and licensed under the open source MIT license.

    February 7, 2014 at 11:27:07 AM GMT+1 - permalink - archive.org - https://twistedmatrix.com/trac/
    event python
  • Introduction — virtualenv 1.11.2 documentation

    virtualenv is a tool to create isolated Python environments.

    February 7, 2014 at 11:26:25 AM GMT+1 - permalink - archive.org - http://www.virtualenv.org/en/latest/virtualenv.html
    python
  • Designing a RESTful API with Python and Flask - miguelgrinberg.com

    je me mets ça de côté pour plus tard.

    via https://arnaudb.net/shaarli

    January 10, 2014 at 1:24:11 PM GMT+1 - permalink - archive.org - http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
    python rest
  • thumbnail
    python-crontab 1.5.1 : Python Package Index

    Librairie python qui va nous servir pour piclodio2 (https://github.com/Sispheor/Piclodio2)

    Chaque réveil est en fait une ligne dans le cron, avec un commentaire dans lequel on retrouve son id.. Du coup avec cette lib, l'interaction avec le cron va être + simple :-)

    via Nico

    November 29, 2013 at 12:12:00 PM GMT+1 - permalink - archive.org - https://pypi.python.org/pypi/python-crontab
    cron piclodio python
  • thumbnail
    unix - How can I pretty-print JSON from the command line? - Stack Overflow

    Pour rendre un json lisible :

    cmd_qui_donne_du_json | python -mjson.tool

    November 21, 2013 at 3:53:39 PM GMT+1 - permalink - archive.org - http://stackoverflow.com/questions/352098/how-can-i-pretty-print-json-from-the-command-line
    json python
  • 10 raisons pour lesquelles je suis toujours marié à Python | Sam & Max: Python, Django, Git et du cul

    python ou perl, faudrait choisir pour concevoir des scripts d'admin moins crades qu'en bash

    November 11, 2013 at 9:18:45 AM GMT+1 - permalink - archive.org - http://sametmax.com/10-raisons-pour-lesquelles-je-suis-toujours-marie-a-python/
    python
  • Créer un module xchat (python)

    Objectif : tapper /obug <number> dans xchat m'ouvre un onglet dans ff vers l'url du bug

    1) activer le module python dans les options
    2) créer un fichier .py dans /home/arnaud/.xchat2/
    3)
    module_name = "openbuginredmine"
    module_version
    = "1.0"
    __module_description__ = "module to open bug in redmine"

    import os
    import xchat

    def obug(word, word_eol, userdata):
    if len(word) < 2:
    print "Second arg must be the bug number!"
    else:

    xchat.command("NOTICE @%s %s" % (xchat.get_info("channel"), word_eol[1]))

        os.system("firefox https://monurlredmine.com/issues/"+word[1])
    return xchat.EAT_ALL 

    xchat.hook_command("obug", obug, help="/obug <number> open bug in ff")

    Et voilà, plus qu'à reboot le xchat, ou bien /load nomdufichier.py

    ça peut etre appliqué à plein de trucs : pouvoir lancer ce qu'on veut depuis xchat

    November 5, 2013 at 3:07:31 PM GMT+1 - permalink - archive.org - http://xchat.org/docs/xchatpython.html#head-cf24838660500eceef2367deb88df5963483c852
    auto module python redmine xchat
  • PythonVsPhp - Python Wiki

    Différence entre python et php
    Et un site pour débuter en python lorsqu'on vient de php :
    http://www.inspyration.org/tutoriels/debuter-python-lorsque-lon-vient-de-php

    September 9, 2013 at 8:26:17 AM GMT+2 - permalink - archive.org - https://wiki.python.org/moin/PythonVsPhp
    php python
  • Unicode HOWTO — Python v3.3.2 documentation

    Qu'est ce que l'unicode ? qu'est-ce qu'un encodage ? Comment python gère ça
    Autres liens dans l'article à lire :
    http://www.cs.tut.fi/~jkorpela/unicode/guide.html
    http://www.joelonsoftware.com/articles/Unicode.html
    http://en.wikipedia.org/wiki/Character_encoding
    http://en.wikipedia.org/wiki/UTF-8

    September 9, 2013 at 8:17:25 AM GMT+2 - permalink - archive.org - http://docs.python.org/3/howto/unicode.html
    encodage python unicode utf8
  • Understanding Python's "with" statement

    with statement

    September 6, 2013 at 10:25:43 AM GMT+2 - permalink - archive.org - http://effbot.org/zone/python-with-statement.htm
    python with
  • Forums Python — AFPY

    Forum pour demander de l'aide/chercher des réponses sur Python

    August 27, 2013 at 2:02:13 PM GMT+2 - permalink - archive.org - http://www.afpy.org/forums/forum_python
    forum help python
  • Python | Codecademy

    Site pour apprendre à développer avec une approche interactive. Python en particulier

    March 22, 2013 at 8:52:04 PM GMT+1 - permalink - archive.org - http://www.codecademy.com/tracks/python
    dev python
Links per page: 20 50 100
page 1 / 1
Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Help/documentation